Forum Discussion

Vitaliy's avatar
Vitaliy
Helper I
5 years ago
Solved

Calculate for missing category (DAX)

Hi ! Please, help with this task: I have 4 simple tables with some relations like in screenshot. How can I build result table? Result description: For C1 category we have 2 Contacts Co1, Co2. Thi...
  • Jihwan_Kim's avatar
    5 years ago

    Hi, Vitaliy 

    Please check the below picture and the sample pbix file's link down below, whether it is what you are looking for.

     

     

     

    Activity Count =
    IF (
    SELECTEDVALUE ( Catetory[ID] ) = "Non Seg",
    CALCULATE ( COUNTROWS ( ContactActivity ), ALLSELECTED ( ContactActivity ) )
    - CALCULATE (
    DISTINCTCOUNT ( ContactActivity[Callid] ),
    ALLSELECTED ( Catetory )
    ),
    IF (
    NOT ISBLANK ( SELECTEDVALUE ( Catetory[ID] ) ),
    COALESCE ( DISTINCTCOUNT ( ContactActivity[Callid] ), 0 ),
    BLANK ()
    )
    )

     

     

    https://www.dropbox.com/s/o3665ejobsuhyhe/vitaliy.pbix?dl=0 

     

     

    Hi, My name is Jihwan Kim.

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

    Linkedin: https://www.linkedin.com/in/jihwankim1975/