Forum Discussion
IF or SWITCH
- 6 years ago
Hi memarquez ,
Ran this through the Dax Formatter Daxformatter.com. Try it now, and if does not work, let us know what the output is.
Let me know if you have any questions. Remember if it finds a true as it drops through the tests, it stops and returns that value. You may want to break up the code into separate lines even if they have the same values. e.g (2) for readability and debugging.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
NathanielMeasure = SWITCH ( TRUE (), Sheet1[encoded] = 1, 0, Sheet1[learnersbringdrinkingwater] = 1, 1, Sheet1[withdrinkingwaterbutnotregular] = 1 && ( Sheet1[hassafewaterthatistested] = 1 || Sheet1[schoolrequireswaterqualitycertif] = 1 || Sheet1[waterisboiled] = 1 || Sheet1[waterisfiltered] = 1 ), 2, Sheet1[withdrinkingwaterallthetime] = 1 && ( Sheet1[hassafewaterthatistested] = 1 || Sheet1[schoolrequireswaterqualitycertif] = 1 || Sheet1[waterisboiled] = 1 || Sheet1[waterisfiltered] = 1 ), 2, Sheet1[withfreewater] = 1 && Sheet1[withdrinkingwaterallthetime] = 1 && Sheet1[hassafewaterthatistested] = 1 || Sheet1[schoolrequireswaterqualitycertif] = 1 || Sheet1[waterisboiled] = 1 || Sheet1[waterisfiltered] = 1, 3, BLANK () )
Hi memarquez
Can you provide a sample of your data and I will plug your formula into it and try and see if I can figure this out
Thanks, Brian
- memarquez6 years agoNew Member
Hello bpsearle
Here's the sample of our data we are currently working. We'll be glad if you can help us on this.
Thanks,
Marvin
withdrinkingwaterbutnotregular withnodrinkingwater withfreewater learnersbringdrinkingwater schoolrequireswaterqualitycertif waterisboiled waterisfiltered hassafewaterthatistested 1 0 1 1 0 1 0 1 1 0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 0 1 0 1 1 0 1 1 1 1 1 1 1 0 1 1 0 0 0 1 0 0 1 1 1 0 1 1 0 0 1 1 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 0 0