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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mohammedmqi
Regular Visitor

the difference value between year

hi everyone 

i'm newbi at power bi

have this table

mohammedmqi_1-1603106156483.png

 

 

so i switch it to matrix to

 

mohammedmqi_2-1603106247456.png

and now i need to show The difference between 2019 and 2020 rahter than toatal becuse i don't need total

(differenceValue=2020-2019)

how can i do that?!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@mohammedmqi , create a separate year/date table and use a formula like this

 

This Year = CALCULATE(sum('Table'[Amount]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Amount]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

 

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@mohammedmqi , create a separate year/date table and use a formula like this

 

This Year = CALCULATE(sum('Table'[Amount]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Amount]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

 

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

thanks for reply 

i use this for this yaer 

 

This Year = CALCULATE(sum(GENERALJOURNALACCOUNTENTRY[AMOUNT]),filter(ALL(GENERALJOURNALACCOUNTENTRY[DateGJ].[Year]),GENERALJOURNALACCOUNTENTRY[DateGJ].[Year]=max(GENERALJOURNALACCOUNTENTRY[DateGJ].[Year])))

 

and this last year 

Last Year = CALCULATE(sum(GENERALJOURNALACCOUNTENTRY[AMOUNT]),filter(ALL(GENERALJOURNALACCOUNTENTRY[DateGJ]),GENERALJOURNALACCOUNTENTRY[DateGJ]=max(GENERALJOURNALACCOUNTENTRY[DateGJ])-1))

 

so i need to reviw the this calculation to make sure

i'll be back after that

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.