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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors
Top Kudoed Authors