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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Xirhandziwa
Frequent Visitor

Power BI measure

https://docs.google.com/spreadsheets/d/1qnh07BRHlbXaGnLkgahf95uXpkDlXgUq5oKS866OMoo/edit?usp=sharing 

 

Hi all,

 

Please help i have attached a link below for the excel sheet i need help with creating a measure that will calculate the columns that are highlighted in blue in the attached excel link 

 

Thanks

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Xirhandziwa,

You can try to use the following measure formulas to achieve your requirement:

mat 2021 = 
VAR currDate =
    MAX ( 'Table'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Table'[2020/2021] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Date] > currDate )
    )
        + CALCULATE (
            SUM ( 'Table'[2021/2022] ),
            FILTER ( ALLSELECTED ( 'Table' ), [Date] <= currDate )
        )

mat 2022 = 
VAR currDate =
    MAX ( 'Table'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Table'[2021/2022] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Date] > currDate )
    )
        + CALCULATE (
            SUM ( 'Table'[2022/2023] ),
            FILTER ( ALLSELECTED ( 'Table' ), [Date] <= currDate )
        )

diff = [mat 2022]-[mat 2021]

1.PNG

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
Xirhandziwa
Frequent Visitor

Hi @v-shex-msft Thank you so much, this worked i really appreciate your help 🤗

Xirhandziwa
Frequent Visitor

Hi @v-shex-msft Thank you so much, this worked i really appreciate your help 🤗

v-shex-msft
Community Support
Community Support

Hi @Xirhandziwa,

You can try to use the following measure formulas to achieve your requirement:

mat 2021 = 
VAR currDate =
    MAX ( 'Table'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Table'[2020/2021] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Date] > currDate )
    )
        + CALCULATE (
            SUM ( 'Table'[2021/2022] ),
            FILTER ( ALLSELECTED ( 'Table' ), [Date] <= currDate )
        )

mat 2022 = 
VAR currDate =
    MAX ( 'Table'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Table'[2021/2022] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Date] > currDate )
    )
        + CALCULATE (
            SUM ( 'Table'[2022/2023] ),
            FILTER ( ALLSELECTED ( 'Table' ), [Date] <= currDate )
        )

diff = [mat 2022]-[mat 2021]

1.PNG

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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