Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

View all the Fabric Data Days sessions on demand. View schedule

Reply
Shivkanyabyale
Frequent Visitor

keep default latest month on scorecard if no month selected

Headcount: =
COUNTAX(
    FILTER(
        Salary,
        Salary[Value] <> 0
    ),
    'Salary'[Particular]
)

this is my measure which counts headcount for me i want to update measure in such a way that when no month selected from date filter then i shoud see latest month headcount if month selected then hedcount of that selected month  date in filter is from datetable and date  of latest month i want to use is from salary table
can anyone help me 
2 REPLIES 2
Shivkanyabyale
Frequent Visitor

Thanks idealy this shoud work but it is giving bank values with or without selecting month
when SelectedMonth used in return i got appropriate selected month but  when used
CALCULATE (COUNTAX (FILTER (Salary,Salary[Value] <> 0 && Salary[Month] = SelectedMonth),'Salary'[Particular]),'Date'[Month] = SelectedMonth)
not getting headcount of any month ,not sure why 

i try selected value function, max month is measure which returns the latest month of salary table 
this is working fine for now 

Headcount: =

VAR SelectedMonth = SELECTEDVALUE(DateTable[Month Year],[max month])
RETURN
    COUNTAX(
        FILTER(
            Salary,
            Salary[Value] <> 0 &&
            (Salary[month]) = SelectedMonth
        ),
        Salary[Particular]
    )

 

dharmendars007
Super User
Super User

Hello @Shivkanyabyale , 

 

Please use the below revised code...

 

Headcount =
VAR SelectedMonth =
IF (
ISFILTERED('Date'[Month]), -- Check if a month is selected
MAX('Date'[Month]), -- Use selected month
CALCULATE(MAX('Date'[Month]), ALL('Date')) -- Use the latest month when no filter is applied
)
RETURN
CALCULATE (COUNTAX (FILTER (Salary,Salary[Value] <> 0 && Salary[Month] = SelectedMonth),'Salary'[Particular]),'Date'[Month] = SelectedMonth)

 

If you find this helpful , please mark it as solution and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors