Forum Discussion
Anonymous
7 years agoNot applicable
DAX - Filtering not working
I have a dax formula that looks at the previous year's data of difference values. I have a slicer which I can choose between Units and Sales. LastYearKPI = if([Attribute Filtered],
SWITC...
- 7 years ago
Anonymous,
It seems that you'll need to add <value>.
https://www.sqlbi.com/articles/filter-arguments-in-calculate/
AlB
Community Champion
7 years agoHi Anonymous
1. Can you explain what you are trying to do for the "Sales" option in the SWITCH?
2. What exactly are you trying to do with
FILTER ( PivotedData, PivotedData[Attribute Value])
3. Can you show your data model or share the pbix? Otherwise it's kinda hard to guess what might be going on
Anonymous
7 years agoNot applicable
I have added a picture to help
- AlB7 years ago
Community Champion
Anonymous
If I'm not mistaken
FILTER(PivotedData,PivotedData[Attribute Value])
will eliminate only rows for which [Attribute Value] is zero or blank( ). Do we agree?
Is that what you want to do?
- Anonymous7 years agoNot applicableThis is my code for the KPI field not LastYearKPI KPI = if([Attribute Filtered], SWITCH( [rankBy] ,"QUS",FORMAT(CALCULATE(sum(MK_PAPA_WEEKLY_PRODUCT_CARE_REPORTING[QUS]),FILTER(PivotedData,PivotedData[Attribute Value])), "#,0") ,"QUS Sales", FORMAT(CALCULATE(sum(MK_PAPA_WEEKLY_PRODUCT_CARE_REPORTING[QUS Sales]),FILTER(PivotedData,PivotedData[Attribute Value])), "£#,##0;(£#,##0)") ,blank())) This works absolutely fine and when you select a slicer of the PivotedData[Attribute Value] it filters the figure by this. I just need it so this works year on year. I can't work out how to put my code in code format in a comment