Forum Discussion

hgrejsen's avatar
hgrejsen
Frequent Visitor
3 years ago

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

 

 

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

  • Anonymous's avatar
    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

    • hgrejsen's avatar
      hgrejsen
      Frequent Visitor

      Hi Anonymous,

       

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

       

       

       

      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