Forum Discussion
Mitig
6 years agoFrequent Visitor
DISTINCTCOUNT for Year Ranges with Two Columns
Greetings, Brand new to PBI here. I am trying to create a measure that counts "ID" column based off of "YEAR" column. HOWEVER, another column ("TERM") has different codes before 2016 than after....
- Anonymous6 years agoTry this
Measure=
Var a=Calculate(distinctcount(table[id]),filter(table,table[year]<2016))
Var b=Calculate(distinctcount(table[id]),filter(table,table[year]>=2016 && table[code]<> 5 &&table[code]<> 10))
Return
If(max(year)<2015,a,b)
Thanks
Pravin
az38
6 years agoCommunity Champion
maybe you should try a measure like
Measure = CALCULATE(DISTINCTCOUNT(Table1[ID]),
FILTER(ALL(Table1), Table1[YEAR]=SELECTEDVALUE(Table1[YEAR]) && (Table1[TERM]>10 || Table1[YEAR]<2016)))Anonymous
6 years agoNot applicable
Try this
Measure=
Var a=Calculate(distinctcount(table[id]),filter(table,table[year]<2016))
Var b=Calculate(distinctcount(table[id]),filter(table,table[year]>=2016 && table[code]<> 5 &&table[code]<> 10))
Return
If(max(year)<2015,a,b)
Thanks
Pravin
Measure=
Var a=Calculate(distinctcount(table[id]),filter(table,table[year]<2016))
Var b=Calculate(distinctcount(table[id]),filter(table,table[year]>=2016 && table[code]<> 5 &&table[code]<> 10))
Return
If(max(year)<2015,a,b)
Thanks
Pravin