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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Tharun
Frequent Visitor

consider selected month is N= Sep, need to calculate N-3 month Quantity and N-6 Month Quantity

Hi,

 

Consider the X axis is Date , Y axis is Plan Date, and Value is Prod Qty. in below screenshot

Tharun_0-1723621989614.png

If user select Sep month in slicer then need to display 2820, consider it as N(Sep)= 2820 then need to display the N-1(AUG)=2820, and N-3(July)=2820 and N-6(Nov) = 2400.

 

calculate the Percenage n-3 diff = ((n-1)-(n-3))/(n-3)

calculate the percentage n-6 diff = ((n-1)-(n-6))/(n-6) 

Tharun_1-1723622377625.png

Can you please help me .

Thanks.

 

5 REPLIES 5
v-xuxinyi-msft
Community Support
Community Support

Hi @Tharun 

 

The following testing is for your reference.

 

My slicer table:

vxuxinyimsft_0-1723707869477.png

 

no relationship between two tables

vxuxinyimsft_1-1723707925000.png

 

Create several measures as follow

n = 
VAR _index = CALCULATE(SUM(slicer[index]), slicer[Month] = SELECTEDVALUE(slicer[Month]))
RETURN
CALCULATE(SUM([Value]), FILTER('Table', 'Table'[Date].[MonthNo] = _index && 'Table'[Date1].[Month] = SELECTEDVALUE(slicer[Month])))

 

n - 1 = 
VAR _index = CALCULATE(SUM(slicer[index]), slicer[Month] = SELECTEDVALUE(slicer[Month]))
RETURN
CALCULATE(SUM([Value]), FILTER('Table', 'Table'[Date].[MonthNo] = _index - 1 && 'Table'[Date1].[Month] = SELECTEDVALUE(slicer[Month])))

 

n - 3 = 
VAR _index = CALCULATE(SUM(slicer[index]), slicer[Month] = SELECTEDVALUE(slicer[Month]))
RETURN
CALCULATE(SUM([Value]), FILTER('Table', 'Table'[Date].[MonthNo] = _index - 3 && 'Table'[Date1].[Month] = SELECTEDVALUE(slicer[Month])))

 

n - 6 = 
VAR _index = CALCULATE(SUM(slicer[index]), slicer[Month] = SELECTEDVALUE(slicer[Month]))
RETURN
CALCULATE(SUM([Value]), FILTER('Table', 'Table'[Date].[MonthNo] = _index - 6 && 'Table'[Date1].[Month] = SELECTEDVALUE(slicer[Month])))

 

Percenage n-3 = DIVIDE([n - 1] - [n - 3], [n - 3])

 

Percenage n-6 = DIVIDE([n - 1] - [n - 6], [n - 6])

 

Output:

vxuxinyimsft_2-1723708097014.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-xuxinyi-msft 

 

Thank you so much this was use full but i need some implementation on this 

can you please help me on this 

 

Tharun_0-1724164278311.png

 

 

Example :- if user select N=May 2023 then need to show like this below screenshot .

calculate the Percenage n-3 diff = ((n-1)-(n-3))/(n-3)

calculate the percentage n-6 diff = ((n-1)-(n-6))/(n-6) 

 

Tharun_2-1724164440660.png

 

 

Hi,

Thank you so much for solution,

can we create it static like this below screenshot 

Tharun_0-1724052914391.png

 

How to create a Slicer table (month and index ) in DAX

Tharun
Frequent Visitor

Present the Matrix looks like this 

 

Tharun_0-1723642040060.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.