Forum Discussion
Switch not working when slicer is selected
- 2 years ago
Hi, thanks for the data!
Names on tables and columns and data are bit different compared to your screenshot so it's difficult for me to verify that this is what you're looking for. But you can find the .pbix here and check. If I've misunderstood how your data is structured, please let me know.I'm assuming now there is a relationship between the tables.
I needed to add ALL('BTCDisplay table') to the total Revenue measure to make it sum in the table, like this:
EBITDA_Revenue = CALCULATE( [EBITDA_Revenue_Apple] + [EBITDA_Revenue_Orange], ALL('BTCDisplay table') )But with this it seems to work.
Does this fix your problem?
- 2 years ago
I figured out why they work now.
Since I removed the BTCDisplay table and then reinstated it. It removed the relationship between the tables. When I add the relationship again, the switch dax on [01Revenue] does not work.
01Revenue works with applied slicers. If you can see the images I have attached, one is with applied slicer (Office = 0105) and one without.
FORMAT was an after thought and it does not make a difference as I have tried SWITCH without it.
Thanks so much for replying.
Then I'm thinking it's the model and evaluation context. Somehow when Office 0105 is selected, MAX(BTCDisplay[Order]) does not equal 1 for that row.
Are you able to share the model, or what the tables look like?
- afwork2 years agoFrequent Visitor
Note: I do not necessarily need to use this dax. I just want to be able to add up in the same column without using a matrix. Other suggestions are welcome. Thanks!
Here's a sample of the data.
BTCDisplay table
Order Main Account BTC_ID 1 Revenue 2 Venue EBITDA_Revenue_Apple 3 Production EBITDA_Revenue_Orange PL_Transactions
BTC_ID OfficeCode AccountingAmt EBITDA_Revenue_Orange 0101 -100000 EBITDA_Revenue_Apple 0101 -100000 EBITDA_Revenue_Orange 0101 -100000 EBITDA_Revenue_Apple 0101 -100000 EBITDA_Revenue_Apple 0105 -100000 EBITDA_Revenue_Apple 0101 -100000 EBITDA_Revenue_Orange 0101 -100000 EBITDA_Revenue_Orange 0105 -100000 - TomasAndersson2 years ago
Solution Sage
Hi, thanks for the data!
Names on tables and columns and data are bit different compared to your screenshot so it's difficult for me to verify that this is what you're looking for. But you can find the .pbix here and check. If I've misunderstood how your data is structured, please let me know.I'm assuming now there is a relationship between the tables.
I needed to add ALL('BTCDisplay table') to the total Revenue measure to make it sum in the table, like this:
EBITDA_Revenue = CALCULATE( [EBITDA_Revenue_Apple] + [EBITDA_Revenue_Orange], ALL('BTCDisplay table') )But with this it seems to work.
Does this fix your problem?
- afwork2 years agoFrequent Visitor
That worked! Thank you!!!!! Not sure if because of ALL().
I think it's because I opened your file. It mentioned something about your file being in a newer version. The reason I think that is because I have other measures adding up other measures like [01Revenue] but I didn't add ALL() to those, yet they somehow work now too.
This is what I did:
1. Opened your file
2. Opened my file, added ALL to [01Revenue]. It didn't seemed to work.
3. I removed BTCDisplay in my file and added it again.
4. Slicers now work.
WOW!
What version do you have?
Thank you again. I'm so excited! I really appreciated it.