Forum Discussion

DeBIe's avatar
DeBIe
Icon for Post Partisan rankPost Partisan
4 years ago
Solved

Requesting help for customer requirement

Hello everybody,   I've been spending a while thinking on how to solve a customer question. Can't get it to work like the way the customer wants to see it (check the desired result at the bottom). ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    HI DeBIe,

    You can create a calculated column on the template table to lookup values from the company table, then you can write a measure to calculate the count.

    Calculate column:

     

    Company = LOOKUPVALUE('Company Code'[Company],'Company Code'[Sector],'Template Codes'[Sector])

     

    Measure formula:

     

    formula =
    CALCULATE (
        COUNTA ( 'Company Code'[Code] ) + 0,
        FILTER (
            ALLSELECTED ( 'Company Code' ),
            'Company Code'[Code]
                IN VALUES ( 'Template Codes'[Code] )
                    && 'Company Code'[Sector] IN VALUES ( 'Template Codes'[Sector] )
        )
    )

     

    Regards,

    Xiaoxin Sheng