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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

diffrence between 2 rows

Sachin93_0-1661431910604.png

Hi, I want to subtract the value from the year 2022 - 2021, can someone help me for creating measure so i can put the diffrence value just below the 2021,2022 row.

 

i created below measure which gives 2 years value while selecting only one year in the slicer.

YearSlicerMeasure =
var Yearselection = SELECTEDVALUE ('Date'[year])



return
if(
     (max(vw_CLG_vwMLSFlashAllData_PowerPivot_FACTS[year]) <= yearselection
&&                   
    max(vw_CLG_vwMLSFlashAllData_PowerPivot_FACTS[year]) >= yearselection - 1)
                                                                                                                                     ,1,0)
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file whether it suits your requirement.

 

Picture1.png

 

New Lease Count Measure: =
VAR _recenttyear =
    CALCULATE ( MAX ( Data[Year] ), ALL ( Data[Year] ) )
VAR _previousyear = _recenttyear - 1
VAR _diff =
    CALCULATE ( SUM ( Data[NewLeaseCount] ), Data[Year] = _recenttyear )
        - CALCULATE ( SUM ( Data[NewLeaseCount] ), Data[Year] = _previousyear )
RETURN
    SWITCH (
        TRUE (),
        ISINSCOPE ( Data[Year] ), SUM ( Data[NewLeaseCount] ),
        ISINSCOPE ( Data[Month] ), _diff
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file whether it suits your requirement.

 

Picture1.png

 

New Lease Count Measure: =
VAR _recenttyear =
    CALCULATE ( MAX ( Data[Year] ), ALL ( Data[Year] ) )
VAR _previousyear = _recenttyear - 1
VAR _diff =
    CALCULATE ( SUM ( Data[NewLeaseCount] ), Data[Year] = _recenttyear )
        - CALCULATE ( SUM ( Data[NewLeaseCount] ), Data[Year] = _previousyear )
RETURN
    SWITCH (
        TRUE (),
        ISINSCOPE ( Data[Year] ), SUM ( Data[NewLeaseCount] ),
        ISINSCOPE ( Data[Month] ), _diff
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Anonymous
Not applicable

Hi, @Jihwan_Kim 
It works, Thank You for your support.

Sachin93_0-1661512427272.png

 

Helpful resources

Announcements
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.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

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.