cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
matrix_user
Helper III
Helper III

A solution to subtract between two periods based on report year (not year) and filtered by quarter

I am trying to find a DAX solution or not so DAX to have the difference between two columns:

matrix_user_0-1675934092628.png

I want to be able to subtract, for example California's Min of Remaning 2022 with Min Remain 2021 as well as Min Sold 2022 with Min Sold 2021. The calculation is filtered by Quarter 3.

 

The end result I am looking for is "+3" in the table below ("Sold change").

matrix_user_1-1675934303135.png

Onedrive

https://1drv.ms/u/s!AjsGK-eaU2PkgRkPsxf0g0p9lrIv?e=aajEir

 

Dropbox

https://www.dropbox.com/scl/fo/80ekjxxz6j7j214b0qyqf/h?dl=0&rlkey=51t12rrnw114jj78ejqlk2nvq

3 REPLIES 3
AdaKAda
Helper I
Helper I

You have to change the [Year] to a Whole number datatype for this: 
 
Remaining change = min('Fact table'[Remaining]) - calculate(MINX('Fact table', [Remaining]), 'Fact table'[Year] = SELECTEDVALUE('Fact table'[Year])-1)
 
Sold change = min('Fact table'[Sold]) - calculate(MINX('Fact table', [Sold]), 'Fact table'[Year] = SELECTEDVALUE('Fact table'[Year])-1)
 
 
AdaKAda
Helper I
Helper I

🤔According to your description the Sold change highlighted should be +1 not +3?

My apoligies, yes you are correct.

Helpful resources

Announcements
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors