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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Comparing values to earlier values.

Hello,

I'm in a  bit of a pickle and can't figure out how to compare data values. Image for refference.
Sketch.png

What I would like to do is to compare the names (left) with the values based upon dates. E.g.

Akrylux -124.90 - 11/10/2017 has increased by 26% on the date 2/28/2018. Just calculate a simple growth rate. 

growth= (present-past)/past

And then monthly - however some months dont have data - empty. Is there a way to treat those empty months as 0? And then show current month growth as 0? With the last growth figure by its side - with the last growth date?

The picture above is a Visualation (table) with the selected fields. name - sales - date.


Thank you for inputs.

Regards,
David.

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please try to add calculated columns with below DAX:

past =
LOOKUPVALUE (
    Tb2[Values],
    Tb2[Names], Tb2[Names],
    Tb2[Dates], CALCULATE (
        MAX ( Tb2[Dates] ),
        FILTER ( ALLEXCEPT ( Tb2, Tb2[Names] ), Tb2[Dates] < EARLIER ( Tb2[Dates] ) )
    )
)

growth =
IF ( Tb2[past] = BLANK (), 0, ( Tb2[Values] - Tb2[past] ) / Tb2[past] )

1.PNG

 





And then monthly - however some months dont have data - empty. Is there a way to treat those empty months as 0? And then show current month growth as 0? With the last growth figure by its side - with the last growth date?

I cannot understand above requirement well, please illustrate your desired result with more details.

 

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

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please try to add calculated columns with below DAX:

past =
LOOKUPVALUE (
    Tb2[Values],
    Tb2[Names], Tb2[Names],
    Tb2[Dates], CALCULATE (
        MAX ( Tb2[Dates] ),
        FILTER ( ALLEXCEPT ( Tb2, Tb2[Names] ), Tb2[Dates] < EARLIER ( Tb2[Dates] ) )
    )
)

growth =
IF ( Tb2[past] = BLANK (), 0, ( Tb2[Values] - Tb2[past] ) / Tb2[past] )

1.PNG

 





And then monthly - however some months dont have data - empty. Is there a way to treat those empty months as 0? And then show current month growth as 0? With the last growth figure by its side - with the last growth date?

I cannot understand above requirement well, please illustrate your desired result with more details.

 

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.
Anonymous
Not applicable

When trying the dataset which is computed manually @v-yulgu-msft it works like a charm! But the issue still persists with that error in a normal table.

Thank you for your response @v-yulgu-msft, however the callculated collumn shows me this error.
"A table of multiple values was supplied when a single value was expected"

Could the issue be that my NAMES (company) are related from another collumn and my vallues(margin real) are callculated collumn as well?
Sketch.png

 



Regarding the monthly growth what I would like to do is a moving average of monthly/ 3 months/ 6 months.
I think I know how to do it (DAX below). But would like to do it by the Company (NAMES in your pbix). Not that advanced in DAX when it comes towards this.

Moving 3 AVG =
CALCULATE (
    AVERAGE ( Orders[Margin Real] );
    DATESINPERIOD (
        Orders[actual_delivery_date];
        LASTDATE ( Orders[actual_delivery_date] );
        -3;
        MONTH
    )
)


Thank you for your help and time @v-yulgu-msft.



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.