The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi Team,
I am trying to show different values based on the currency selection.
Here are the Rules
Sum Vol :
1) IF 1 currency is selected than show sum of 1 currency
2) IF 1 or more currency is selected than show sum of EURconverted
3) IF nothing is selected than show All Currency
The dax below works for rule 1 and 3 but not 2.
I have tried using a count curreny dax :
Here is my dax
Solved! Go to Solution.
For your question, here is the method I provided:
Here's some dummy data
"Dealer Ranking"
Create a measure. Count the total number of selected slicers.
Currency Count =
COUNTROWS(
VALUES('Dealer Ranking'[Currency])
)
Create a measure. Calculate the sum of Ranking Size.
Ranking Size (Vol) =
VAR CurrencyCount = [Currency Count]
VAR SelectedCurrency = IF(HASONEVALUE('Dealer Ranking'[Currency]), SELECTEDVALUE('Dealer Ranking'[Currency]), BLANK())
VAR SumSingleCurrency =
CALCULATE(
SUM('Dealer Ranking'[Ranking Size]),
'Dealer Ranking'[Currency] = SelectedCurrency
)
VAR SumEURConverted =
SUMX(
'Dealer Ranking',
[Ranking Size]
)
VAR SumAllCurrencies =
CALCULATE(
SUM('Dealer Ranking'[Ranking Size]),
ALL('Dealer Ranking'[Currency])
)
RETURN
SWITCH(
TRUE(),
CurrencyCount = 1, SumSingleCurrency,
CurrencyCount = 2, SumEURConverted,
SumAllCurrencies)
Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
For your question, here is the method I provided:
Here's some dummy data
"Dealer Ranking"
Create a measure. Count the total number of selected slicers.
Currency Count =
COUNTROWS(
VALUES('Dealer Ranking'[Currency])
)
Create a measure. Calculate the sum of Ranking Size.
Ranking Size (Vol) =
VAR CurrencyCount = [Currency Count]
VAR SelectedCurrency = IF(HASONEVALUE('Dealer Ranking'[Currency]), SELECTEDVALUE('Dealer Ranking'[Currency]), BLANK())
VAR SumSingleCurrency =
CALCULATE(
SUM('Dealer Ranking'[Ranking Size]),
'Dealer Ranking'[Currency] = SelectedCurrency
)
VAR SumEURConverted =
SUMX(
'Dealer Ranking',
[Ranking Size]
)
VAR SumAllCurrencies =
CALCULATE(
SUM('Dealer Ranking'[Ranking Size]),
ALL('Dealer Ranking'[Currency])
)
RETURN
SWITCH(
TRUE(),
CurrencyCount = 1, SumSingleCurrency,
CurrencyCount = 2, SumEURConverted,
SumAllCurrencies)
Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Can you share some sample data to work with? 🙂
Proud to be a Super User!
User | Count |
---|---|
65 | |
60 | |
55 | |
54 | |
32 |
User | Count |
---|---|
180 | |
88 | |
70 | |
46 | |
45 |