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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Kudoed Authors