cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
augustindelaf Skilled Sharer
Skilled Sharer

Re: IF formula with multiple conditions

@v-qiuyu-msft, any news ?

 

I would be happy if you could help me.

thanks in advance !

Community Support
Community Support

Re: IF formula with multiple conditions

Hi @augustindelaf,

 

Please try to create a measure like below to see if it meet your requirement:

 

Measure = SWITCH(TRUE(),MAX('DATA(Update KPIs)'[Work Stream ])="WS 1.1" || MAX('DATA(Update KPIs)'[Work Stream ])="WS2.1" || MAX('DATA(Update KPIs)'[Work Stream ])="WS 3.1" || MAX('DATA(Update KPIs)'[Work Stream ])="WS 3.4",SUM('DATA(Update KPIs)'[KPI 2 Monthly Actual]),
 MAX('DATA(Update KPIs)'[Work Stream ])="WS 2.2" || MAX('DATA(Update KPIs)'[Work Stream ])="WS 3.5",AVERAGE('DATA(Update KPIs)'[KPI 2 Monthly Actual]))

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
augustindelaf Skilled Sharer
Skilled Sharer

Re: IF formula with multiple conditions

@v-qiuyu-msft,

 

a lady from the MS support gave me a solution that seems ok :

 

---

"

Hi Augustin,

 

Here are the measures that you will need:

 

  1. SelectedValue = IF (ISFILTERED ( Example[Indicator1] ) && HASONEVALUE ( Example[Indicator1] );LASTNONBLANK ( Example[Indicator1]; 0 );"a default value");
  2. SumValues = SUM(Example[Values]);
  3. VarKPI2MonthlyTGTR = IF([SelectedValue]="WS"; AVERAGE(Example[Values]); [SumValues]);

 

In will need to substitute what is in orange with your dimensions.

 

And here are some interesting documentation:

 https://msdn.microsoft.com/en-us/library/ee634396.aspx;
http://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/;

 

"

---

 

 

View solution in original post

bbdiver526
Frequent Visitor

Re: IF formula with multiple conditions

I'm relatively new to PowerBI and DAX and I'm having a problem with a similar issue (not as complicated I think). I need to use the volume if it is current YTD, Actuals and ITA otherwise 0.

 

These are the two DAX statements I have tried:

_CurrentYearITA = IF('AMER DBP Retail Bookings'[DTF_Current_ITA_YTD] = "Y"||'AMER DBP Retail Bookings'[PL_PlanCode] = "ACTUALS"|| 'AMER DBP Retail Bookings'[CO_Company] = "ITA";'AMER DBP Retail Bookings'[_Volume];0)

 

and

 

_CurrentYearITA = IF(AND('AMER DBP Retail Bookings'[DTF_Current_ITA_YTD] = "Y",'AMER DBP Retail Bookings'[PL_PlanCode] = "ACTUALS",'AMER DBP Retail Bookings'[CO_Company] = "ITA"),'AMER DBP Retail Bookings'[_Volume],0)

 

The first one gives a bad syntax error starting with the semi-colon after "ITA" and the second one says too many arguments for AND function.

 

Any assistance would be appreciated.

Shafi293
Frequent Visitor

Re: IF formula with multiple conditions

Try This if u want ...

CalculatedColumn= SWITCH(
TRUE(),
TableName[ColumnName] = "A",
Value(123),
TableName[ColumnName] = "B",
Value(124),
TableName[ColumnName] = "C",
Value(125),
TableName[ColumnName] = "D",
Value(126),
TableName[ColumnName] = "E",
Value(127),
TableName[ColumnName] = "F",
Value(128),
TableName[ColumnName] = "G",
Value(129),
TableName[ColumnName] = "H",
Value(130),
TableName[ColumnName] = "I",
Value(131),
TableName[ColumnName] = "J",
Value(132),
TableName[ColumnName] = "K",
Value(134),
TableName[ColumnName]= "L",
Value(135),
TableName[ColumnName] = "M",
Value(136),

-1)

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors