Forum Discussion

kl8818's avatar
kl8818
Frequent Visitor
3 years ago
Solved

Count Help

Hello - needing help formulating a measure to help count for visual. Goal - Card Visual to show count of how many employees w/ 1 or more logins Card Visual to show percentage of employees w/ 3 ...
  • Jihwan_Kim's avatar
    3 years ago

    Hi,

    I am not sure if I understood your question correctly,  but please check the below picture and the attached pbix file.

    I tried to create a datamodel like below.

    I hope the below can provide some ideas on how to create a solution for your datamodel.

     

     

     

    Count employee with 1 or more login: = 
    VAR _t =
        ADDCOLUMNS (
            VALUES ( Employee[Employee ID] ),
            "@logincount", CALCULATE ( COUNTROWS ( Data ) )
        )
    RETURN
        COUNTROWS ( FILTER ( _t, [@logincount] >= 1 ) )

     

    Percentage employee with 3 or more login: = 
    VAR _employeecount =
        COUNTROWS ( VALUES ( Employee[Employee ID] ) )
    VAR _t =
        ADDCOLUMNS (
            VALUES ( Employee[Employee ID] ),
            "@logincount", CALCULATE ( COUNTROWS ( Data ) )
        )
    VAR _threeormore =
        COUNTROWS ( FILTER ( _t, [@logincount] >= 3 ) )
    RETURN
        DIVIDE ( _threeormore, _employeecount )