Forum Discussion

winniexlee's avatar
winniexlee
New Member
3 years ago

Filter card when selected and show default value when not selected

Hi Experts,

 

I have this data here whereas my table has these 3 columns:

1. Month

2. Year

3. Employee Name

 

I want my Card to show the distinctcount of employee name on the latest Month & Year by default, and show the selected Month and Year if there is any selection. 

 

Kindly advise! Thank you!

6 Replies

  • hi   winniexlee 

    try like:

    Measure = 
    VAR _MaxYear = CALCULATE(MAX(TableName[Year]), ALL(TableName[Year]))
    VAR _MaxMonth =
    MAXX(
        FILTER(TableName, TableName[Year] = _MaxYear), 
        TableName[Month]
    )
    VAR _CountMax = 
    CALCULATE(
        DISTINCTCOUNT(TableName[Employee Name]),
        TableName[Year] = _MaxYear,
        TableName[Month] =_MaxMonth
     )
    RETURN
    IF(
        NOT ISFILTERED(TableName[Year]) || ISFILTERED(TableName[Month]),
        _CountMax,
        DISTINCTCOUNT(TableName[Employee Name])
    )
      • winniexlee's avatar
        winniexlee
        New Member

        Hihi, the result is not showing correctly.

         

        I forgotten to mention that i have a column name "Employment Type" in another table, whereas i only want to look at those that are labour supply or permanent employees. Is it possible to use Month Name instead of Month Number also?