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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Add zero to previous months only

Hi,

 

I think this one should be pretty simple but for some reason I cannot think of a way to do it.

 

I have a measure to which I am adding zero.. measure = dax + 0 so I get 0 to plot on a graph that needs zero plots.

 

However, this graph has 2019 vs 2020 and now the zero values are on November and December 2020 too.

Any idea how I would stop that? Sort of like Add zero only IF the month is < current month.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Add a measure like

if( Max(Date[Date]) <= eomonth(today(),-1), [measure]+0,[measure])

 

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Add a measure like

if( Max(Date[Date]) <= eomonth(today(),-1), [measure]+0,[measure])

 

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Awesome, thanks both 🙂

Anonymous
Not applicable

Hi @Anonymous : You will get the current Month Value using

CurrentMonth= Month(Today())

 

You can use this in your IF Clause-

IF( Month < CurrentMonth, dax+ 0, dax)

 

Hope this helps.

 

Cheers,

-Namish B

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.