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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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