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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Cumulative total of day categories (Dax measure and Calculated column)

I am trying to create a bar graph that along the x axis we have the categories: 5 days +. 6 days +, 7 days +, 8 days +, 9 days +, 10+ days.

Along the Y axis we have Count of repairs.

 

The purpose is to show how many repairs at each stage there are. This should be cumulative so the first category should always be the tallest bar. For example (apologies for the crude drawing):

ADPowerBI1_0-1679388430092.png

 

 all repairs in 6+ should also be counted in 5+, because they have also been in repair more than 5 days.

 

Currently I have:
[Count of Repairs]

'table'[Days in repair]    (this is the number of days the job has been in repair.

 

How do i create a measure/columns to give me a group that sorts my repairs into categories (5days+,6days+ etc) and how do I write a measure to group my repairs cumulatively?

 

Thanks so much for any help.

 

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

Hi @Anonymous ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1679538029102.png

Please try:

First create a new table for x-axis:

X-Axis = {"5+","6+","7+","8+"}

Then apply the measure to the column visual:

Count of Repairs = 
var _a = VALUE(LEFT(MAX('X-Axis'[Value]),LEN(MAX('X-Axis'[Value])-1)))
return CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER('Table',[Days in repair]>_a))

vjianbolimsft_1-1679538133209.png

Final output:

vjianbolimsft_2-1679538152791.png

Best Regards,

Jianbo Li

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

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

I am not sure how much i can help but i would like to try.  Share the download link of the PBI file.  Only keep tables/columns there which are necessary to solve this question.  Remove all irrelevant tables/columns.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1679538029102.png

Please try:

First create a new table for x-axis:

X-Axis = {"5+","6+","7+","8+"}

Then apply the measure to the column visual:

Count of Repairs = 
var _a = VALUE(LEFT(MAX('X-Axis'[Value]),LEN(MAX('X-Axis'[Value])-1)))
return CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER('Table',[Days in repair]>_a))

vjianbolimsft_1-1679538133209.png

Final output:

vjianbolimsft_2-1679538152791.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Amazing, works like a charm, thank you so much!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.