Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

calculate sum between two dates

Hi All ,

I want to calculate the running total of license quntity between start_date_updated and expried date  in a bar chart where i show the data in month wise . 

 

 two date fields are inactive releationship with master calender as shown below 

harsha087_0-1673967038071.png

 

I tried writing DAX logic but i m facing ambiguity in relationships.

Please help with DAX logic . 

 

@amitchandak @Greg_Deckler 

13 REPLIES 13
Ashish_Mathur
Super User
Super User

Hi,

Shares some data (in a format the can be pasted in an MS Excel file), explain the question and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Sir

for the given below sample data we need calculate rolling sum per year . 

Please help me sir ..

Anonymous
Not applicable

Hi Sir Need to calculate the sum of license qty between the start date and expried date . need to exclude the records if  Difference between start and expored date is greater than 365 days . 

in my power bi report , i have two table . One table is given below and another table is master calender .

Below is the sample data 

start_dateexpired_datelicense_quantity
1/1/201612/31/201615
12/31/202112/30/2022167
1/1/201912/31/2019176
3/23/202012/31/202030
3/23/202012/31/2020150
1/1/202012/31/2020150
1/1/201812/31/2018-25
1/1/201812/31/201835
1/1/201612/31/201686
12/12/201412/31/2014107
2/10/202212/31/2022165
1/1/202112/31/2021121
1/1/201912/31/20193
1/1/201912/31/2019184
1/1/202112/31/2021121
9/9/201812/31/20181
9/9/201812/31/20182
9/9/201812/31/20181
9/9/201812/31/20181
9/9/201812/31/20181
9/9/201812/31/20181
9/9/201812/31/2018169
1/1/201912/31/20193
1/1/201912/31/2019184
1/1/202312/31/202321
5/4/202112/31/20211
2/18/20213/26/20211
2/18/20213/26/20211
1/1/202112/31/20211
1/1/202112/31/202118
11/12/202012/30/20201
5/4/202112/31/20211
2/18/20213/26/20211
2/18/20213/26/20211
1/1/202112/31/20211
10/25/202112/31/202120
9/2/202112/31/2021200
1/1/202012/31/202013
1/1/201912/31/20195
1/1/201912/31/201910
1/1/201912/31/20195
1/1/201712/31/2017246
1/1/201812/31/2018200
2/25/202212/31/2022141
12/31/202112/30/202279
1/1/202112/31/202110
1/1/202112/31/202174
1/1/202012/31/20201
1/1/202012/31/202085
2/19/201912/31/201915

Hi,

As requested in my message on January 19, 2023, show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi,

We need to calculate running total of license qty between start and end date . Where both the dates are inactive releationship with master calender as shown in my post

 

Below is the data

Licence QtyStart _dateExpired _date
148,3611/1/202112/31/2021
8021/28/202112/31/2021
3342/24/202112/31/2021
2192/23/202112/31/2021
1852/25/202112/31/2021
1502/1/202112/31/2021
152/21/202112/31/2021
2703/23/202112/31/2021
1023/11/202112/31/2021
373/31/202112/31/2021
1983/28/202112/31/2021
453/22/202112/31/2021
133/16/202112/31/2021
173/24/202112/31/2021
1593/8/202112/31/2021
1063/31/202112/30/2021
2283/9/202112/31/2021
2453/18/202112/31/2021
2423/15/202112/31/2021
1294/6/202112/31/2021
1184/29/202112/31/2021
84/22/202112/31/2021
124/30/202112/31/2021
304/29/202112/30/2021
164/23/202112/31/2021
544/12/202112/31/2021
634/20/202112/31/2021
14/23/202112/30/2021
1415/5/202112/31/2021
1865/4/202112/31/2021
15/24/202112/30/2021
195/20/202112/31/2021
2265/12/202112/31/2021
635/24/202112/31/2021
165/28/202112/31/2021
205/27/202112/31/2021
725/14/202112/31/2021
715/25/202112/31/2021
55/6/202112/30/2021
3745/19/202112/31/2021
2745/2/202112/30/2021
245/9/202112/30/2021
895/6/202112/31/2021
135/11/202112/30/2021
605/3/202112/31/2021
135/13/202112/30/2021
265/10/202112/30/2021
45/17/202112/31/2021
45/11/202112/31/2021
15/12/202112/30/2021
155/13/202112/31/2021
25/31/202112/30/2021

 

Expected Output

MonthSum(License Qty)Rolling License Qty
1149,163149,163
2903150,066
31662151,728
4431152,159
51719153,878

 

 

Hi,

The way you have described it, there is no use of the Expiry date column.  You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Sir,

we should use expiry date to calculate the license qty which fall in between the selected year . 

i have records where date diff between the start and end is more than 365 days .

Below is one example

If a user select year 2021 .. it means we need to calcualte the license qty between 01/01/2021 and 31/12/2021 

License QtyStart_dateExpired_dateStatus 
148,3611/1/202112/31/2021Should Consider 
2511/1/202112/30/2022Should Not consider
as expiry date is beyond 31/12/2021

 

Please help me sir .. 

Hi,

i will not be able to help unless you take a representative example and show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi 

 

Thanks for quick response ..

 

i will try it .. 

Anonymous
Not applicable

Need Help @bolfri , @Ashish_Mathur , @Idrissshatila 

 

its urgent 

amitchandak
Super User
Super User

@Anonymous , Seem like you need active count, refer if these can help

 

Power BI: HR Analytics - Employees as on Date : https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

Power BI HR Active Employee Tenure Bucketing, and Hired, Terminated, and Active employees: https://youtu.be/fvgcx8QLqZU

 

 

In case you need cumulative of active

 

you can try like

 

Cumm Sales = CALCULATE(SUMX(values(Date[Date]),[Active Measure]),filter(allselected(date),date[date] <=max(date[Date])))

Anonymous
Not applicable

Hi,

We need to calculate running total of license qty between start and end date . Where both the dates are inactive releationship with master calender as shown in my post

 

Below is the data

Licence QtyStart _dateExpired _date
148,3611/1/202112/31/2021
8021/28/202112/31/2021
3342/24/202112/31/2021
2192/23/202112/31/2021
1852/25/202112/31/2021
1502/1/202112/31/2021
152/21/202112/31/2021
2703/23/202112/31/2021
1023/11/202112/31/2021
373/31/202112/31/2021
1983/28/202112/31/2021
453/22/202112/31/2021
133/16/202112/31/2021
173/24/202112/31/2021
1593/8/202112/31/2021
1063/31/202112/30/2021
2283/9/202112/31/2021
2453/18/202112/31/2021
2423/15/202112/31/2021
1294/6/202112/31/2021
1184/29/202112/31/2021
84/22/202112/31/2021
124/30/202112/31/2021
304/29/202112/30/2021
164/23/202112/31/2021
544/12/202112/31/2021
634/20/202112/31/2021
14/23/202112/30/2021
1415/5/202112/31/2021
1865/4/202112/31/2021
15/24/202112/30/2021
195/20/202112/31/2021
2265/12/202112/31/2021
635/24/202112/31/2021
165/28/202112/31/2021
205/27/202112/31/2021
725/14/202112/31/2021
715/25/202112/31/2021
55/6/202112/30/2021
3745/19/202112/31/2021
2745/2/202112/30/2021
245/9/202112/30/2021
895/6/202112/31/2021
135/11/202112/30/2021
605/3/202112/31/2021
135/13/202112/30/2021
265/10/202112/30/2021
45/17/202112/31/2021
45/11/202112/31/2021
15/12/202112/30/2021
155/13/202112/31/2021
25/31/202112/30/2021

 

Expected Output

MonthSum(License Qty)Rolling License Qty
1149,163149,163
2903150,066
31662151,728
4431152,159
51719153,878

 

Anonymous
Not applicable

i have seen the HR analytics logics and i have implemented it .. but i m not getting correct results .. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.