Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Finding Delta

Hello all I have a table 

 

With Columns: 

 

IDplatformstatus
1aactive
2aactive
3aInactive
4bactive
5bactive
6bInactive
7cactive
8cactive
9cactive

 

 

Another table with columns:  

IDProductplatform
1xa
2xa
4yb
5yb
7yc
8yc
9y

c

 

Now the product x is only for ID 1 & 2 so other ID do not have product 1 & 2 so If I have a bar plot with 

 

x - axis product 

y-  axis count

 

and if I drill thorough I need to get the delta so, for product x it is 4, 5, 7 8, 9 has they are active and do not have have product x

 

 

I would use SQL NOT EXISTS and get the delta but Here I would like to have filter and drill through functionality so, not understanding what to use particularly.

 

Thank you for your time and help.

  • Anonymous's avatar
    Anonymous
    7 years ago
    Measure =
     
    VAR __ids = SELECTCOLUMNS('Table19',"__id",[ID])
    VAR __allIds = ALL('Table18'[ID])
    VAR __otherIds = EXCEPT(__allIds,__ids)
    RETURN IF(SELECTEDVALUE(Table18[ID], 0) IN (__otherIds), 1, 0)
     
    The above measure is working as I wanted it to. by setting a visual filter for a table visual. where Measure IS 1
     
    Thank you Greg_Deckler  and Anonymous  for your time.
     

8 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Here I am trying to display all the IDs that are not present instead of sum!

       

      so ouput we be something like

       

      ID
      4
      5
      7
      8
      9
      • Greg_Deckler's avatar
        Greg_Deckler
        Icon for Community Champion rankCommunity Champion

        It's really pretty much the same thing:

         

        Measure 14 = 
        VAR __ids = SELECTCOLUMNS('Table19',"__id",[ID])
        VAR __allIds = ALL('Table18'[ID])
        VAR __otherIds = EXCEPT(__allIds,__ids)
        RETURN
        CONCATENATEX(__otherIds,[ID],", ")

        See Page 6, Tables 18 and 19. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      I have created a measure that is giving me the count

       

      CALCULATE(COUNT(TABLE1[ID]), TABLE1[Status] = 'Active') - DISTINCTCOUNT(TABLE2[ID])

       

       

      BUT Instead of Numbers I want to display the actual ID  Greg_Deckler 

  • Anonymous's avatar
    Anonymous
    Not applicable
    Measure =
     
    VAR __ids = SELECTCOLUMNS('Table19',"__id",[ID])
    VAR __allIds = ALL('Table18'[ID])
    VAR __otherIds = EXCEPT(__allIds,__ids)
    RETURN IF(SELECTEDVALUE(Table18[ID], 0) IN (__otherIds), 1, 0)
     
    The above measure is working as I wanted it to. by setting a visual filter for a table visual. where Measure IS 1
     
    Thank you Greg_Deckler  and Anonymous  for your time.