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
frankhofmans
Helper IV
Helper IV

Cumulative totals

hi all,

 

I want to create a cumulative table of the number of sickness cases and the duration of the cases. I have the following data table:

 

Employee IDAbsence in working days
1012
5193
1479
23112
4453
3624
915
1697
3775
2915

 

I want to create the following outcome:

 

Days of absence12345678910>10
# of cases013466778810
As % of total0%10%30%40%60%60%70%70%80%80%100%

 

I tried to find the solution in previous posts, but i couldn't find the exact answer.

 

Thanks in advance,

 

Regards, Frank

1 ACCEPTED SOLUTION
v-diye-msft
Community Support
Community Support

Hi @frankhofmans 

 

Plz let me know whether you'd like to get below one:

Capture.PNG

Measure = var a = IF(ISBLANK(COUNTROWS(FILTER('Table',[Absence in working days]<=1))),0,COUNTROWS(FILTER('Table',[Absence in working days]<=1)))
var b = COUNTROWS(FILTER('Table',[Absence in working days]<=2))
var c = COUNTROWS(FILTER('Table',[Absence in working days]<=3))
var d =  COUNTROWS(FILTER('Table',[Absence in working days]<=4))
var e = COUNTROWS(FILTER('Table',[Absence in working days]<=5))
var f = COUNTROWS(FILTER('Table',[Absence in working days]<=6))
var g = COUNTROWS(FILTER('Table',[Absence in working days]<=7))
var h = COUNTROWS(FILTER('Table',[Absence in working days]<=8))
var i = COUNTROWS(FILTER('Table',[Absence in working days]<=9))
var j = COUNTROWS(FILTER('Table',[Absence in working days]<=10))
var k = COUNTROWS(FILTER('Table',[Absence in working days]>10||[Absence in working days]<=10))
return SWITCH(TRUE(),MAX('Table2'[Days of absence])="1",a,MAX('Table2'[Days of absence])="2",b,MAX('Table2'[Days of absence])="3",c,MAX('Table2'[Days of absence])="4",d,MAX('Table2'[Days of absence])="5",e,MAX('Table2'[Days of absence])="6",f,MAX('Table2'[Days of absence])="7",g,MAX('Table2'[Days of absence])="8",h,MAX('Table2'[Days of absence])="9",i,MAX('Table2'[Days of absence])="10",j,k)
Measure 2 = DIVIDE([Measure],MAXX(ALL(Table2),[Measure]))

Pbix attached.

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

5 REPLIES 5
v-diye-msft
Community Support
Community Support

Hi @frankhofmans 

 

Plz let me know whether you'd like to get below one:

Capture.PNG

Measure = var a = IF(ISBLANK(COUNTROWS(FILTER('Table',[Absence in working days]<=1))),0,COUNTROWS(FILTER('Table',[Absence in working days]<=1)))
var b = COUNTROWS(FILTER('Table',[Absence in working days]<=2))
var c = COUNTROWS(FILTER('Table',[Absence in working days]<=3))
var d =  COUNTROWS(FILTER('Table',[Absence in working days]<=4))
var e = COUNTROWS(FILTER('Table',[Absence in working days]<=5))
var f = COUNTROWS(FILTER('Table',[Absence in working days]<=6))
var g = COUNTROWS(FILTER('Table',[Absence in working days]<=7))
var h = COUNTROWS(FILTER('Table',[Absence in working days]<=8))
var i = COUNTROWS(FILTER('Table',[Absence in working days]<=9))
var j = COUNTROWS(FILTER('Table',[Absence in working days]<=10))
var k = COUNTROWS(FILTER('Table',[Absence in working days]>10||[Absence in working days]<=10))
return SWITCH(TRUE(),MAX('Table2'[Days of absence])="1",a,MAX('Table2'[Days of absence])="2",b,MAX('Table2'[Days of absence])="3",c,MAX('Table2'[Days of absence])="4",d,MAX('Table2'[Days of absence])="5",e,MAX('Table2'[Days of absence])="6",f,MAX('Table2'[Days of absence])="7",g,MAX('Table2'[Days of absence])="8",h,MAX('Table2'[Days of absence])="9",i,MAX('Table2'[Days of absence])="10",j,k)
Measure 2 = DIVIDE([Measure],MAXX(ALL(Table2),[Measure]))

Pbix attached.

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
amitchandak
Super User
Super User

@frankhofmans , if [Absence in working days] is the measure. Then it is the case of dynamic segmentation. You need to create a bucket table for Days of absence, and the use measure to deal with it.

 

Please refer my video if that can help

https://youtu.be/CuczXPj0N-k

 

Or refer

https://www.daxpatterns.com/dynamic-segmentation/
https://www.daxpatterns.com/static-segmentation/
https://www.poweredsolutions.co/2020/01/11/dax-vs-power-query-static-segmentation-in-power-bi-dax-po...
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization

hi,

 

I can't replicate the correct dax formula from your Youtube video. Could you help me further with the needed formula(s)?

 

Thanks in advance,

 

Regards, Frank

@frankhofmans , Try like

Brand Bucket = divide(Countx(filter(VALUES('Table'[Employee ID]),[Absence in working days] >=Min('Days Bucket'[Start Limit]) && [Margin %] <max('Days Bucket'[End Limit])),'Table'[Employee ID]),calculate('Table'[Employee ID],allselected(Table)))

 

Brand Bucket = divide(Countx(filter(VALUES('Table'[Employee ID]),[Absence in working days] >=Min('Days Bucket'[Start Limit]) && [Margin %] <max('Days Bucket'[End Limit])),'Table'[Employee ID]),calculate('Table'[Employee ID]))

 

Bucket will 1-1, 1-2 till 10 and 10 -10000 <Big Number>

hi,

 

thanks, i'm getting closer. But my absence in working days isn't a measure, but a calculated column in the data table. Do you have suggestion for that?

 

thanks!

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.