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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
userdata
Helper IV
Helper IV

Calculated measure to get if current month is june, not working correctly

Hi,

 

I have a question regarding a measure that is not working properly.What i want to achieve is if current month is jan, feb or march, then do sum( sales1a and sum of sales1b), if current month falls under month april, may, june then use sales2, but for some reason the measure is not working. This is what I have :  

 

IF(MONTH(today())= 1 ,([sales1a]+[sales 1b]),
IF(MONTH(TODAY())=2,([sales1a]+[sales1b]),if(MONTH(TODAY())= 3 ,([sales1a]+[sales1b]),
if(MONTH(TODAY())=4, ([sales2a]+[sales2b]),if(MONTH(TODAY())=5, ([sales2a]+[sales2b]),if(MONTH(TODAY())=6, ([sales2a]+[sales2b]),0)))
 
 
The measure itself doesnt give any errors but the issue is when i test it and drag all months in there , it does give me values for every month, but the issue is if we the current month is feb, then it should calculate sales1a and sales1b, but as current month is not jan or june or july etc, it should give a 0. For some reason when i have month, year and the measure in the table, it does also give values where the current month is not in that specific month. It should give me only values if icurrent month is eg. feb, but should give a 0 for all the other months.
Thanks!
3 REPLIES 3
userdata
Helper IV
Helper IV

userdata_0-1621874286277.png

if you see measure 2, doesnt add up for some reason sales 1a and sales 1b and second it gives values, although it should only give values when current month falls under one of those months. 

 

amitchandak
Super User
Super User

@userdata , Try a measure like

 

Switch(True(),
MONTH(today()) <4, ([sales1a]+[sales 1b]) ,
MONTH(today()) <7, ([sales2a]+[sales2b])
)

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

Thanks for the reply but that wont solve it because the issue is that it will calculate sales 1a and 1b only if its bigger than.It gives me the same values as the above formula.  The thing I want to achieve is if current month falls under month 1,2 or 3, then do sales1a and sales1b, if current month falls under month 4,5,6 then do sales2a and sales2b, otherwise 0 . I tried an or function but that gave me errors. I think maybe I have to define curren month differently? 

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.