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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
hgrejsen
Frequent Visitor

Issues using IF function for each row = the same values is returned

Hi,

 

I want to create a pareto grafh for monthly reporting. My plan is that I want to see the past month (Reporting Month) and the privious 3 months before that (In the same color). 

 

My plan was to create a promt to the user where they can chose the reporting month Number

 hgrejsen_0-1683031026662.png

 

I have created a Date_Tabel with a

MonthNum = MONTH('Date_Table'[Date])
 
A measure:
SelectedMonth2 = SELECTEDVALUE('Reporting Month'[Reporting Month])
 
Then my plan was to make a IF function and the use that one as my Legend in the graph
 
Visual = if(Date_Table[MonthNum] = [SelectedMonth2] , "Reporting Month","Privious Months")
 
 
But the IF function returnes the same value for each row.
 
If I enter in a number insted of [SelectedMonth2] it works fine
 
How do I get it to work so that each row is evaluated against the input parameter?
 
(The Reporting Month'[Reporting Month] is linked to theDate_Table[MonthNum] in the modelling)
 
I appressiate any help
2 REPLIES 2
Anonymous
Not applicable

Hi @hgrejsen ,

In order to better understand your demands and give the right solution, could you please provide some more specific information? such as your desensitized example data and a screenshot of your desired results?

Thanks for your efforts & time in advance.

 

Best regards,
Community Support Team_Binbin Yu

Hi @Anonymous,

 

If I were to do it in normal excel I would do it like this:

 

hgrejsen_1-1683179821324.png

 

 

I hope this makes you understand what I want. In my trials in Power BI my IF function does not work when I try to use a prompted parameter but it does work when I just use a constant number. 

 

Br Helene

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.