How to create a column to show difference between two dates only for particular month?

%3CLINGO-SUB%20id%3D%22lingo-sub-2989897%22%20slang%3D%22en-US%22%3EHow%20to%20create%20a%20column%20to%20show%20difference%20between%20two%20dates%20only%20for%20particular%20month%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2989897%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20creating%20a%20Leave%20request%20system.%20So%20far%20I%20have%20created%20List%20including%20From%20and%20To%20column%20and%20have%20added%20Flows%20for%20approval%20and%20rejection.%20This%20all%20works%20good.%20We%20have%20different%20types%20of%20leave%20such%20as%20Sick%20Leave%2C%20Paid%20Leave%2C%20Care%20giver%20leave%20and%20few%20others.%20We%20want%20to%20add%20a%20view%20where%20we%20can%20see%20how%20many%20leaves%20for%20each%20category%20has%20been%20taken%20in%20a%20particular%20month.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20created%20a%20view%20and%20done%20the%20group%20by%20Leave%20type%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22vikshitjain_0-1637491207198.png%22%20style%3D%22width%3A%20522px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F328402i82E645BAC82A5A54%2Fimage-dimensions%2F522x187%3Fv%3Dv2%22%20width%3D%22522%22%20height%3D%22187%22%20role%3D%22button%22%20title%3D%22vikshitjain_0-1637491207198.png%22%20alt%3D%22vikshitjain_0-1637491207198.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20created%20a%20calculated%20column%20with%20Formula%20(Group%20By%20leave)%3A%26nbsp%3B%3DDATEDIF(From%2CTo%2C%22d%22)%2B1%3C%2FP%3E%3CP%3EThis%20gives%20me%20the%20count%20of%20leaves%20including%20from%20and%20To.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIssue%3A%20If%20we%20see%20first%20entry%20in%20Care%20giver%2C%20from%20and%20To%20spans%20across%20a%20single%20month%20so%20we%20get%20count%208%20and%20we%20are%20good%20with%20it.%3C%2FP%3E%3CP%3EBut%20if%20we%20second%20item%2C%20from%20date%20is%20in%20November%20and%20To%20date%20is%20in%20Dec%20and%20we%20get%20count%205.%20We%20want%20this%20to%20show%20as%203.%20And%20remaining%202%20when%20in%20month%20of%20December.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20any%20way%20we%20could%20achieve%20this%20by%20creating%20any%20hidden%20columns%20or%20using%20Flow%3F%3C%2FP%3E%3CP%3EAny%20suggestions%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2989897%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2990726%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20create%20a%20column%20to%20show%20difference%20between%20two%20dates%20only%20for%20particular%20month%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2990726%22%20slang%3D%22en-US%22%3EThere%20is%20a%20PNP%20project%20only%20for%20extension%2C%20includes%20field%2C%20try%20there%2C%20you%20can%20ask%20for%20help%20also%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fpnp%2Fsp-dev-fx-extensions%2Ftree%2Fmain%2Fsamples%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fpnp%2Fsp-dev-fx-extensions%2Ftree%2Fmain%2Fsamples%3C%2FA%3E%3C%2FLINGO-BODY%3E
New Contributor

I'm creating a Leave request system. So far I have created List including From and To column and have added Flows for approval and rejection. This all works good. We have different types of leave such as Sick Leave, Paid Leave, Care giver leave and few others. We want to add a view where we can see how many leaves for each category has been taken in a particular month. 

 

I have created a view and done the group by Leave type:

vikshitjain_0-1637491207198.png

 

I created a calculated column with Formula (Group By leave): =DATEDIF(From,To,"d")+1

This gives me the count of leaves including from and To. 

 

Issue: If we see first entry in Care giver, from and To spans across a single month so we get count 8 and we are good with it.

But if we second item, from date is in November and To date is in Dec and we get count 5. We want this to show as 3. And remaining 2 when in month of December.

 

Is there any way we could achieve this by creating any hidden columns or using Flow?

Any suggestions?

 

 

1 Reply
There is a PNP project only for extension, includes field, try there, you can ask for help also

https://github.com/pnp/sp-dev-fx-extensions/tree/main/samples