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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Sha
Helper II
Helper II

Display 0 for past months and blank for future months

I have data (id and date) in one table and I'm wanting to show line graph for last year and this year (Jan-Dec).  I am wanting to see the 0 rows but don't want to see the future months 0 rows.  I have Date table = EngDate and the following measures.  The measures bring back the correct count but display continues to show future months of 0.  

Measures: 

EngCnt =CALCULATE(DISTINCTCOUNT(Engagement[EngagementID]) +0)
EngCntLY = CALCULATE(DISTINCTCOUNT(Engagement[EngagementID]),SAMEPERIODLASTYEAR('EngDate'[Date]))+0
 
I've tried changing measure to filter on max (ELM date = 3/31/2020), but then March doesn't show the 0 it should.
EngCnt = CALCULATE(DISTINCTCOUNT(Engagement[EngagementID]),filter(EngDate,EngDate[Date]<=max(EngDate[ELM Date]) +0))
1 ACCEPTED SOLUTION
Sha
Helper II
Helper II

Nevermind, just figured it out. 

EngCnt =
CALCULATE(DISTINCTCOUNT(Engagement[EngagementID]),filter(EngDate,EngDate[Date]<=max(EngDate[ELM Date])+0))+0
 
EngCntELM =
    if(max('EngDate'[Date]) <= max('EngDate'[ELM Date]),[EngCnt],BLANK())

View solution in original post

1 REPLY 1
Sha
Helper II
Helper II

Nevermind, just figured it out. 

EngCnt =
CALCULATE(DISTINCTCOUNT(Engagement[EngagementID]),filter(EngDate,EngDate[Date]<=max(EngDate[ELM Date])+0))+0
 
EngCntELM =
    if(max('EngDate'[Date]) <= max('EngDate'[ELM Date]),[EngCnt],BLANK())

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.