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

Dax Filter

Hello, I tried to find a solutiuon for what I am trying to accomplish via this Forum and Youtube and I am grasping some concepts but unable to piece them together.  I have a column with data from different periods with associated values. I require a total of each period and then subtract those those totals. For instance Sum of 2020 P2 - Sum of 2020 P1. I am guessing that I have to use a Sum command and a Filter Command. 

 

Thank you for your assistance! 

 

Capture.JPG

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Create a new period Table and create a rank on the period

 

Period Rank = RANKX(all('Period'),'Period'[Period],,ASC,Dense)
This Period = CALCULATE(sum('order'[Qty]), FILTER(ALL('Period'),'Date'[Period Rank]=max('Date'[Period Rank])))
Last Period = CALCULATE(sum('order'[Qty]), FILTER(ALL('Period'),'Date'[Period Rank]=max('Date'[Period Rank])-1))

 

Same approch I followed for week

Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Create a new period Table and create a rank on the period

 

Period Rank = RANKX(all('Period'),'Period'[Period],,ASC,Dense)
This Period = CALCULATE(sum('order'[Qty]), FILTER(ALL('Period'),'Date'[Period Rank]=max('Date'[Period Rank])))
Last Period = CALCULATE(sum('order'[Qty]), FILTER(ALL('Period'),'Date'[Period Rank]=max('Date'[Period Rank])-1))

 

Same approch I followed for week

Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123

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.