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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

Using IF Function based on filtered Month selection

Hello, I am looking for some urgent help in fixing a DAX measure please. 

I am essentially trying to create a measure using the IF Function based on what Month has been filtered on in the dashbaord, eg) if Jan is selected i want one formula to be used and if September is selected i want a different formula to be used. 

I have the formulas for a False & True result from the if function ready but the trouble I am having is building the If Function formula and linking that to the Month table in the query, here is what I have so far when practicing with January, note I also tried "Jan"; 

= IF((SUM(Months[Month]) = {"1"})     

The Month table in the query is laid out like the following just for reference:

Month   Index
Jan         1 
Feb         2
etc etc 


I am pretty new to this so any help would be greatly appreciated thank you so much in advance!! 🙂 




2 REPLIES 2
dedelman_clng
Community Champion
Community Champion

Hi @Anonymous - use SELECTEDVALUE on the month.

 

Measure = 
SWITCH( SELECTEDVALUE(Month[Month]),
"Jan", FormulaA,
"Feb", FormulaB,
...
)

 

SWITCH also helps you by not having imbedded IF statements.  Here is a good site to help you with the language: https://dax.guide/ . It can give you more info on the functions mentioned here.

 

Hope this helps

David

Anonymous
Not applicable

Great thank you so much!!

 

Just one more follow on query please..

I'm playing around with the formula as i'm trying to get the first half of the year to have one result and the second half of the year to have a different result, i've tried this but it doesn't work:

 

MONTH TEST = SWITCH( SELECTEDVALUE(Months[Month]), "Jan, Feb, Mar, Apr, May, June", 1, "Jul, Aug, Sep, Oct, Nov, Dec", 2)
 
Do you know how to do this?
Many thanks

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.