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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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