Forum Discussion
How to calculate unique count based on multiple column values
- 7 years ago
You might try adding a FILTER function to your measure. The concept is the same, but the syntax should allow multiple columns in the condition.
Test 2 = CALCULATE ( DISTINCTCOUNT ( sj_strata_encounter_hb[FINNBR] ), FILTER ( sj_strata_encounter_hb, OR ( sj_strata_encounter_hb[MS DRG CODE] IN { "10", "266", "621" }, sj_strata_encounter_hb[ADMIT ICD10 DX CODE] IN { "S48.23", "C24", "P12" } ) ) )
I'm hard coding a measure.
I get an error that" The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression"
Here is my test measure:
You might try adding a FILTER function to your measure. The concept is the same, but the syntax should allow multiple columns in the condition.
Test 2 =
CALCULATE (
DISTINCTCOUNT ( sj_strata_encounter_hb[FINNBR] ),
FILTER (
sj_strata_encounter_hb,
OR (
sj_strata_encounter_hb[MS DRG CODE] IN { "10", "266", "621" },
sj_strata_encounter_hb[ADMIT ICD10 DX CODE] IN { "S48.23", "C24", "P12" }
)
)
)- jtownsend217 years agoResponsive Resident
jmalone I just had an "Oh Duhh" moment. Your way should be easier/better.
- jmalone7 years agoResolver III
jtownsend21 - I have those moments all the time :smileylol:
- tbobolz7 years agoResolver I
Thanks to both of you for your help. I still learning my world in more advanced DAX.
jmalone, the measure was excepted, however, it states it can not load the visual, "MdxScript(Mdoel) (20, 180) Calculation error in measure, ....Test2: Function 'CONTAINSROW' does not support comparing values of Textwith values of type Integar. Consider using the VALUE or FORMAT finction to convert one of the values"
I sure I just need to walk away from this and I might be able to see my issue. LOL
Any thoughts.
- tbobolz7 years agoResolver I
Yep, went for a walk and it sovled my issue.
Much thanks to both of you!!!
- jtownsend217 years agoResponsive Resident
Was the issue the quotations on the DRG values in the function?