Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Cameron94
Partner - Contributor III
Partner - Contributor III

Multiple IF statements

Hi,

I am trying to add multiple if statements to a single chart. 1 works fine but I cant figure out how to add a second successfully without error. 

Example:

IF((vDimension) ='FX_Rates_Year',AVG(Exchange_Rate),'')

IF((vDimension) ='FX_Rates_Month',SUM(Exchange_Rate),'')

IF((vDimension) ='FX_Rates_Quarter',AVG(Exchange_Rate),'')

Does anyone know how I would correct this?

Labels (5)
1 Solution

Accepted Solutions
Iswarya_
Creator
Creator

Hi @Cameron94 ,

Try like this:

IF((vDimension) ='FX_Rates_Year',AVG(Exchange_Rate),

       IF((vDimension) ='FX_Rates_Month',SUM(Exchange_Rate),

                IF((vDimension) ='FX_Rates_Quarter',AVG(Exchange_Rate),'')))

View solution in original post

4 Replies
Iswarya_
Creator
Creator

Hi @Cameron94 ,

Try like this:

IF((vDimension) ='FX_Rates_Year',AVG(Exchange_Rate),

       IF((vDimension) ='FX_Rates_Month',SUM(Exchange_Rate),

                IF((vDimension) ='FX_Rates_Quarter',AVG(Exchange_Rate),'')))

Mark_Little
Luminary
Luminary

Hi

As suggested, the if need to be nested. 

 

Anku
Creator
Creator

Instead of nested ifs, you can try

Pick(Match('$(vDimension)', 'FX_Rates_Year', 'FX_Rates_Month', 'FX_Rates_Quarter'), AVG(Exchange_Rate), SUM(Exchange_Rate), AVG(Exchange_Rate)
)

And modify it accordingly. Hope it will work. 

Cameron94
Partner - Contributor III
Partner - Contributor III
Author

Amazing, thanks so much. Can I ask a question though? Is there a particular reason for this format? As a newbie, the whole spacing out part seems odd.