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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
lsihui_
Frequent Visitor

How to create table showing differences of two period/waves

Hi, 

 

In my current dataset, there are values for two waves in each year. The ideal output is to have a slicer to select any of the two waves and the matrix table will show the differences between the older wave and newer wave selected.

E.g.,

  • if 2021 wave 1 and 2021 wave 2 is selected, the differences should be 200-100=100
  • if 2024 wave 2 and 2023 wave 1 is selected, the differences should be 800-500=300

Please advise how I can set up this matrix table. Thank you!

 

Current dataset

lsihui__0-1739249941162.png

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @lsihui_ 

 

Create a separate dimension table for Year/Wave and then create this measure:

 

Difference = 
VAR FirstSelected =
    CALCULATE ( MIN ( YearWave[Year/Wave] ), ALLSELECTED ( YearWave ) )
VAR SecondSelected =
    CALCULATE ( MAX ( YearWave[Year/Wave] ), ALLSELECTED ( YearWave ) )
VAR FirstValue =
    CALCULATE (
        SUM ( Data[Value] ),
        KEEPFILTERS ( YearWave[Year/Wave] = FirstSelected )
    )
VAR SecondValue =
    CALCULATE (
        SUM ( Data[Value] ),
        KEEPFILTERS ( YearWave[Year/Wave] = SecondSelected )
    )
RETURN
    SecondValue - FirstValue

 

danextian_0-1739253177352.png

The measure will return the difference between max and min selected values. Selections in between these are ignored.

Please se the attached sample pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

1 REPLY 1
danextian
Super User
Super User

Hi @lsihui_ 

 

Create a separate dimension table for Year/Wave and then create this measure:

 

Difference = 
VAR FirstSelected =
    CALCULATE ( MIN ( YearWave[Year/Wave] ), ALLSELECTED ( YearWave ) )
VAR SecondSelected =
    CALCULATE ( MAX ( YearWave[Year/Wave] ), ALLSELECTED ( YearWave ) )
VAR FirstValue =
    CALCULATE (
        SUM ( Data[Value] ),
        KEEPFILTERS ( YearWave[Year/Wave] = FirstSelected )
    )
VAR SecondValue =
    CALCULATE (
        SUM ( Data[Value] ),
        KEEPFILTERS ( YearWave[Year/Wave] = SecondSelected )
    )
RETURN
    SecondValue - FirstValue

 

danextian_0-1739253177352.png

The measure will return the difference between max and min selected values. Selections in between these are ignored.

Please se the attached sample pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors