Forum Discussion
Problem with Previous YTD for Ranked Sales
Hi, m_wex
Thank you for your feedback.
Sorry, and I am not able to downgrade mine.
Is it possible to post the dax formulas? It might be a while before I get my version upgraded.
- Jihwan_Kim5 years ago
Super User
Hi, m_wex
Thank you for your message.
Please check the below.
Total Sales =SUM(Sales[Sales])CY Ranked Customer Sales =VAR rankingdimemsion =VALUES ( Customers[Customer] )VAR rankingselect =SELECTEDVALUE ( RankGroup[Indicator], 5 )RETURNCALCULATE ([Total Sales],FILTER (rankingdimemsion,RANKX ( ALL ( Customers[Customer] ), [Total Sales],, DESC ) <= rankingselect))Test YTD =VAR lastsalesdate =MAXX ( ALL ( Sales[Date] ), Sales[Date] )VAR ytdsales =TOTALYTD ( [CY Ranked Customer Sales], Dates[Date] )RETURNIF ( MAX ( Dates[Date] ) <= lastsalesdate, ytdsales, BLANK () )PYTD =CALCULATE( [Test YTD], DATEADD(Dates[Date],-1,YEAR))Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
- m_wex5 years ago
Helper I
Hi Jihwan Kim,
Sorry for the delayed feedback on this. I had to take a pause for another project.
How do you filter out the blanks on the results without using a filter. The totals are affected when using ISNOTNULL on the YTD Sales, this happens when you look at all sales. You can have a blank in the current year but sales in the previous year which is why filtering out ISNOTNULL does not work.