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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Calculate line graph starting at 100%

Hi!

I am trying to create a graph like the one below in PowerBI (same idea, way different data). The idea is that whatever I pick as first date, it will use that value as 100% and recalculate the other measures accordingly.
 
fgonzalezv_0-1670300031682.png

 

To do it I am trying to obtain the Minimum date in the range, calculate the base value and then do the division. Nonetheless, 
as output I am obtaining only 1's (a flat line in the chart). It is giving me the same BaseValue as CurrentValue.
 
Thanks in advance!
 
Here is my code:
 
Display_value =
Var MinYear = CALCULATE(
    MIN('Revenues with Main artist'[Date]),
    ALLSELECTED('Revenues with Main artist'[Date])
    )
Var BaseValue =  CALCULATE(
    SUM('Revenues with Main artist'[Monthly Total Gross Sales]),
    REMOVEFILTERS('Revenues with Main artist'[Monthly Total Gross Sales]),
    'Revenues with Main artist'[Date] = MinYear
)
Var CurrentValue =  CALCULATE(
    SUM('Revenues with Main artist'[Monthly Total Gross Sales]),
    ALLSELECTED('Revenues with Main artist'[Monthly Total Gross Sales])
    )
Var Division = DIVIDE(CurrentValue,BaseValue)
Return(Division)
1 ACCEPTED SOLUTION
pi_eye
Resolver IV
Resolver IV

Hi

 

I was able to create such a chart:

pi_eye_4-1670327587090.png

 

 

Using this as measure:

single adjusted value =
var vminDate = CALCULATE (
    MIN (CPI[Date] ),
    ALLSELECTED ( CPI[Date] )
    )

var vbase = CALCULATE(
    sum(CPI[Sales]),
    FILTER(ALLSELECTED(CPI[Date]),
            CPI[Date]=vminDate))

return (sum(CPI[Sales])/vbase)*100


Try the above, or if you want to edit your code directly, replace the removefilters in the base value with a filter for all selected.

 

one more thing to try:
I noticed that if I have the date as a hierarchy in the chart, it has trouble calculating the min of the date, and returns flat lines

 

Chart with date as hierarchy:

pi_eye_6-1670327640549.png

 

 

However, when I change to the date as a value on it's own ,the problem is solved:

 

Chart with date as single value:

pi_eye_5-1670327623936.png

 

 

 

 

 HTH, 

Pi

 

View solution in original post

3 REPLIES 3
pi_eye
Resolver IV
Resolver IV

Hi

 

I was able to create such a chart:

pi_eye_4-1670327587090.png

 

 

Using this as measure:

single adjusted value =
var vminDate = CALCULATE (
    MIN (CPI[Date] ),
    ALLSELECTED ( CPI[Date] )
    )

var vbase = CALCULATE(
    sum(CPI[Sales]),
    FILTER(ALLSELECTED(CPI[Date]),
            CPI[Date]=vminDate))

return (sum(CPI[Sales])/vbase)*100


Try the above, or if you want to edit your code directly, replace the removefilters in the base value with a filter for all selected.

 

one more thing to try:
I noticed that if I have the date as a hierarchy in the chart, it has trouble calculating the min of the date, and returns flat lines

 

Chart with date as hierarchy:

pi_eye_6-1670327640549.png

 

 

However, when I change to the date as a value on it's own ,the problem is solved:

 

Chart with date as single value:

pi_eye_5-1670327623936.png

 

 

 

 

 HTH, 

Pi

 

Anonymous
Not applicable

Thank you! I have tried all solutions (exhausting them all) and the real issue was the date as a value instead of as a hierarchy,

 

Thanks again! 

It's often something that simple!

 

Glad it helped!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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