cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Responsive Resident

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):

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
Community Support

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

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))``````

Final output:

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.

3 REPLIES 3
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
Community Support

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

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))``````

Final output:

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.

Responsive Resident

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

Announcements

Power BI Monthly Update - July 2024

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

Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors