Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
I need to establish the value of 5 conditions, how to do using DAX?
Exemple:
Group 1 = "18-27",
Group 2 = "28-35",
Group3 = "36-43",
Group 4 = "44-50",
Group 5 = "50+"
I make this formula but is incorrect:
Age Group = IF(AND([Age]>17 [Age]<28),"18-27",
IF(AND([Age]>27, [Age]<36),"28-35",
IF(AND([Age]>35, [Age]<44),"36-43"
IF(AND([Age]>43, [Age]<51),"44-50",
IF([Age]>50,"50+", BLANK())
))))
I Can Help?
Solved! Go to Solution.
look at using the switch statement with true
here is the whole article
https://powerpivotpro.com/2012/06/dax-making-the-case-for-switch/
example taken from above but this is the one you would need to use)
SWITCH(TRUE(),
AND([Fund Balance]>=0, [Fund Balance]<=10000), “Up to $10,000”,
AND([Fund Balance]>=10001, [Fund Balance]<=50000), “$10,001 to 50,000”,
AND([Fund Balance]>=50001, [Fund Balance]<=100000), “$50,001 to 100,000”,
AND([Fund Balance]>=100001, [Fund Balance]<=500000), “$100,001 to 500,000”,
AND([Fund Balance]>=1500001, [Fund Balance]<=1000000), “$500,001 to 1,000,000”,
“greater than $1,000,000”
)
Proud to be a Super User!
look at using the switch statement with true
here is the whole article
https://powerpivotpro.com/2012/06/dax-making-the-case-for-switch/
example taken from above but this is the one you would need to use)
SWITCH(TRUE(),
AND([Fund Balance]>=0, [Fund Balance]<=10000), “Up to $10,000”,
AND([Fund Balance]>=10001, [Fund Balance]<=50000), “$10,001 to 50,000”,
AND([Fund Balance]>=50001, [Fund Balance]<=100000), “$50,001 to 100,000”,
AND([Fund Balance]>=100001, [Fund Balance]<=500000), “$100,001 to 500,000”,
AND([Fund Balance]>=1500001, [Fund Balance]<=1000000), “$500,001 to 1,000,000”,
“greater than $1,000,000”
)
Proud to be a Super User!
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
120 | |
101 | |
71 | |
61 |