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