Forum Discussion
All() dax not working
I know this issue has been raised before in the forum, but still I cannot get it to work.
I've got the most simple example:
3 tables: products, orders and calendar.
products have a status
there are 2 measures: orders this year, orders last year.
When filtering on status in the slicer, this should only be done for orders this year.
We want to see all orders of last year, regardless of the product status. That simple.
Yet when I use the dax
Ordered last year = CALCULATE(sum(Orders[Ordered qty.])
;'Calender'[YearsAgo]=1
;ALL(Products[Status]))
It does not display the products sold last year.
Actually, in my real pbix (I'm using an example here) it's not even showing a total for the 'last year' measure.
Hope anyone has a suggestion.
Thanks,
Johan.
Hi Johan,
Create a table with status:
Status
Open Planned Production
Then make an inactive relationship between Status table and Products Table:
Change your two measure to the following code:
Ordered last year = CALCULATE ( SUM ( Orders[Ordered qty.] ); 'Calendar'[YearsAgo] = 1 ) Ordered this year = CALCULATE ( SUM ( Orders[Ordered qty.] ); 'Calendar'[YearsAgo] = 0; USERELATIONSHIP ( 'Status'[Status]; Products[Status] ) )Now use the Status table on your slicer and everything should work as you want:
Regards,
MFelix
5 Replies
- JohanAdvocate II
Thanks for taking the time to help.
Edit interactions can help is some situations, but not all.
What if I want to display them in 1 table?
Slicer filter = Planned (should only apply to this year)
This year Last Year Mercedes Planned 20 Ford Planned 25 Audi Closed 30 Toyota Closed 35 Ferrari Closed 40 Lada Closed 45 Kind regards,
Johan
- MFelixSuper User
Hi Johan,
Create a table with status:
Status
Open Planned Production
Then make an inactive relationship between Status table and Products Table:
Change your two measure to the following code:
Ordered last year = CALCULATE ( SUM ( Orders[Ordered qty.] ); 'Calendar'[YearsAgo] = 1 ) Ordered this year = CALCULATE ( SUM ( Orders[Ordered qty.] ); 'Calendar'[YearsAgo] = 0; USERELATIONSHIP ( 'Status'[Status]; Products[Status] ) )Now use the Status table on your slicer and everything should work as you want:
Regards,
MFelix