Forum Discussion

mmh's avatar
mmh
Helper I
2 years ago
Solved

calculated column from having only certain value

Hi,

there is application dataset contains ,application_id, activity name.. one application i having many multiple activiy name. so i would like have a calculated column if particular id having only certain activity name. here in below sample data  in every id's have activity name abc along others name, but id 2 only have only abc value. so calculated column should  be type B for id 2 other id type A. 

idactivity namecalculated column 
1abcType A
1xyzType A
1xyType A
2abcType B
2abcType B
3abcType A
3xyType A
3pyType A

Thanks in Advance

  • ok, then try:

    calculated column = IF(CALCULATE(DISTINCTCOUNT('applications'[activity name]),ALLEXCEPT('applications','applications'[id]), 'applications'[activity name] <> "abc") >0, "Type A", "Type B")

3 Replies

  • sjoerdvn's avatar
    sjoerdvn
    Solution Sage

    you haven't mentioned the table name, so for the example below I used "applications":

    calculated column = IF(CALCULATE(DISTINCTCOUNT('applications'[activity name]),ALLEXCEPT('applications','applications'[id])) = 1, "Type B", "Type A")
  • Hi,
    thanks! but i need consider value only i.e abc, as may be other id have distinct value with other value. 

  • sjoerdvn's avatar
    sjoerdvn
    Solution Sage

    ok, then try:

    calculated column = IF(CALCULATE(DISTINCTCOUNT('applications'[activity name]),ALLEXCEPT('applications','applications'[id]), 'applications'[activity name] <> "abc") >0, "Type A", "Type B")