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
dan_yoxall
Helper I
Helper I

Line graph x-axis hierarchy

Hi

 

I have been trying to use a measure to calculate a running total.  Originally I tried the below expression but as you can see from the matrix snapshot below, the calculation started again at the beginning of the each year.

 

Cost Forecast (cumulative) =

CALCULATE(
          SUMX( 'Programme Resource Planning', 'Programme Resource Planning'[Hours] * 'Programme Resource Planning'[Cost]) * MAX('Fee Factor'[Fee Factor]),
          FILTER(
                      ALLSELECTED('Programme Resource Planning'[Week No]),
                      ISONORAFTER('Programme Resource Planning'[Week No], MAX('Programme Resource Planning'[Week No]), DESC)),
          FILTER(
                     VALUES('Programme Resource Planning'[Year]),
                     ISONORAFTER('Programme Resource Planning'[Year], MAX('Programme Resource Planning'[Year]), DESC)))

 

I managed to overcome this issue with the below formula:

 

Cost Forecast (cumulative 2) =
CALCULATE(
          SUMX( 'Programme Resource Planning', 'Programme Resource Planning'[Hours] * 'Programme Resource Planning'[Cost]) * MAX('Fee Factor'[Fee Factor]),
         FILTER(
                     ALL('Programme Resource Planning'), 'Programme Resource Planning'[Date] <= MAX('Programme Resource Planning'[Date])))

 

The issue I have now is I can't represent the results as a line graph (see below).  The second formula is completely wrong!  The first formula is much closer but adds all the values with the same week even if they are from different years.  I'm hoping this is simply a case of sorting the hierachy on the x-axis to show both the year and week no but I can't work out how.  

 

Capture.PNG

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @dan_yoxall,

 

In your scenario, since you have gotten the correct running values via the second measure [Cost Forecast (cumulative 2)], you only need to modify your date hierarchy and chart visual to make it display as you expected.

 

Please create hierarchy like this:

3.PNG

 

Then, click the third drill down icon to locate to Year-WeekNo level.

 

1.PNG

2.PNG

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

1 REPLY 1
v-yulgu-msft
Employee
Employee

Hi @dan_yoxall,

 

In your scenario, since you have gotten the correct running values via the second measure [Cost Forecast (cumulative 2)], you only need to modify your date hierarchy and chart visual to make it display as you expected.

 

Please create hierarchy like this:

3.PNG

 

Then, click the third drill down icon to locate to Year-WeekNo level.

 

1.PNG

2.PNG

Best regards,
Yuliana Gu

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

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.