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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Silvercrest
Frequent Visitor

Replicating an excel table with many measures

Hi,

I am trying to replicate a managers much loved spreadsheet in PowerBI. In excel, he has a table like this, but with 65 rows. So we are trying to achieve this:

 This YearLast YearYear on Year difference
Staff65605
Revenue100110-10
Profit2023-3

 

The data comes into PowerBI in a csv in the form 

MeasureYearValue
Staff202265
Staff202160
Revenue2022100
Revenue2021110
Profitetc 

 

which gives me a table called PIs.

 

How do I do this ? I can do it using UNION and ROW but only if I effectively hardcode the year for last year to 2021. Of course I want it to still work in future years. I can't seem to make an external filter take effect. I know all about the Show values on rows option, but that does not let me calculate the Year on Year Difference.

 

This is my first request for help , so all suggestions very gratefully received!

 

Thank you

 

 

 

 

 

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Silvercrest,

 

Try these measures:

 

This Year = 
VAR vMaxYear =
    CALCULATE ( MAX ( PIs[Year] ), ALL ( PIs ) )
VAR vResult =
    CALCULATE ( MAX ( PIs[Value] ), PIs[Year] = vMaxYear )
RETURN
    vResult
Last Year = 
VAR vMaxYear =
    CALCULATE ( MAX ( PIs[Year] ), ALL ( PIs ) )
VAR vResult =
    CALCULATE ( MAX ( PIs[Value] ), PIs[Year] = vMaxYear - 1 )
RETURN
    vResult
Year on Year Difference = [This Year] - [Last Year]

 

DataInsights_1-1660317680257.png

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Silvercrest
Frequent Visitor

Thank you, that achieved what I needed. 😀 thank you also for the prompt reply - I had spent hours on that.

 

As an encore, can you suggest how the same thing could be achieved but with the lastest year being configurable by the user through a filter - ie if they wanted to go and see what the same figures were last year, so 2021

compared to 2020?

Glad to hear that worked. Here's the encore. 🙂

 

Measures:

 

This Year = 
CALCULATE ( MAX ( PIs[Value] ), PIs[Year] = SELECTEDVALUE ( PIs[Year] ) )
Last Year = 
CALCULATE ( MAX ( PIs[Value] ), PIs[Year] = SELECTEDVALUE ( PIs[Year] ) - 1 )

 

DataInsights_0-1660326789162.png

-----

DataInsights_1-1660326805168.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




DataInsights
Super User
Super User

@Silvercrest,

 

Try these measures:

 

This Year = 
VAR vMaxYear =
    CALCULATE ( MAX ( PIs[Year] ), ALL ( PIs ) )
VAR vResult =
    CALCULATE ( MAX ( PIs[Value] ), PIs[Year] = vMaxYear )
RETURN
    vResult
Last Year = 
VAR vMaxYear =
    CALCULATE ( MAX ( PIs[Year] ), ALL ( PIs ) )
VAR vResult =
    CALCULATE ( MAX ( PIs[Value] ), PIs[Year] = vMaxYear - 1 )
RETURN
    vResult
Year on Year Difference = [This Year] - [Last Year]

 

DataInsights_1-1660317680257.png

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.