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
Anonymous
Not applicable

Difference from previous date aggregate on graph

Hello world, 
I have made this calculation to obtain some specific data

Unapp = 
CALCULATE(COUNT('Dim - Sales'[AR Id]),filter('Fact - Receipts','Fact - Receipts'[AR Status]=="UNAPP"))

and I create this graph
question.png 

What  i want to get is the difference from previous time aggregation, depending on that the user chose form the drill down 
E.G on the current graph it would show for 2019->7k and 2020->-28k , but once the user opens it for month view it would show e.g data for February 2020-data for January 2020
In tableau this is done with difference from previous, over here how can I do it?
Thanks everyone!!

3 REPLIES 3
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could add two fields in x-axis: Year and your date column. Then use ISINSCOPE() function to show the result.

[Sum] is the result of every month, [Measure] is the difference from previous year.

Measure =
VAR a =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[YEAR] = MAX ( 'Table'[YEAR] ) - 1 )
    )
RETURN
    IF ( ISINSCOPE ( 'Table'[Date] ), [SUM], [SUM] - a )

Here is my test file for your reference.

 

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
amitchandak
Super User
Super User

@Anonymous , you have to create diff between each period and merge then into one measure

using

refer : https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

 

Or refer last period Employee in https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

Anonymous
Not applicable

To be honest I don't really get how this isinscope would function with the graph/my data. 

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.