Skip to main content
cancel
Showing results for 
Search instead 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

Reply
ADPowerBI1
Responsive Resident
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):

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 @ADPowerBI1 ,

 

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 @ADPowerBI1 ,

 

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.

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

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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