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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

URGENT- IF statement or SWITCH in a Live connection-Finding it difficult to create this requirement.

Hello Power BI Family,

 

I am new here and please, I really need your help.

I have a report with a LIVE CONNECTION to the data sources. Due to this form connection, I dont have access to the data table in Power BI and I can't also create a CALCULATED COLUMN. I am left with just working with MEASURES. Below is a requirement that i am finding it difficult to create with  a measure.  I am to create a measure with the information below:

------------------------

If ManualFile = RETAIL or DRIVE and if QualifMONO = INTRA, then display INNO1

if ManualFile = CAT  and if QualifPAN = ICAN, then display INNO2 

if ManualFile = PMT and if QualifPMT = PRIO, then display INNO3

if ManualFile = ICE and if QualifMENTRA = MENTS, then display INNO4 

-----------------------

Since I can't create a calculated column due to the Live Connection, Is there any way I can do this with DAX measures? 

Please, I really need your suggestions and solutions to this problem.

 

Thanks in advance.

 

 

 

 

 

 

1 ACCEPTED SOLUTION

you already indicated that you cannot use calculated columns. Measures require aggregators. Not sure what else to say.

 

Note:  You need to protect your "OR" conditions because "AND" takes precedence. Alternatively use IN

 

MEASURE Name :=
SWITCH(TRUE(),
max(ManuelFile_FDV) IN { "Retail" ,"Drive"} && max(QualifMono) = "Innos Pro", 'Inno RS",
max(ManuelFile_FDV) = "XCAT" && max(QualifProxi) = "Innos Prio", 'Inno Proxi",
max(ManuelFile_FDV) = "PMT" && max(QualifPMTAuto) = "Innos Prio", 'Inno PMT",
max(ManuelFile_FDV) = "IC" && max(InnosMetro) = "Innos Prio", 'Inno Metro"
)

 

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thanks alot @Ibendlin.

lbendlin
Super User
Super User

Measures require aggregators.  You need to provide more details on how you want to display the final result before we can suggest which of them to use.

Thanks so Ibendlin for your kind reply.

 

I am actually trying to create a single column with the 4 conditions above met. All the datasets involved are categorical. Below is what I am trying to do using the MEASURE but it doesn't work.

Column Name =
SWITCH(TRUE(),
ManuelFile_FDV = "Retail" || ManuelFile_FDV = "Drive" && QualifMono = "Innos Pro", 'Inno RS",
ManuelFile_FDV = "XCAT" && QualifProxi = "Innos Prio", 'Inno Proxi",
ManuelFile_FDV = "PMT" && QualifPMTAuto = "Innos Prio", 'Inno PMT",
ManuelFile_FDV = "IC" && InnosMetro = "Innos Prio", 'Inno Metro",
BLANK()
)

I hope this will explain the problem more.

you already indicated that you cannot use calculated columns. Measures require aggregators. Not sure what else to say.

 

Note:  You need to protect your "OR" conditions because "AND" takes precedence. Alternatively use IN

 

MEASURE Name :=
SWITCH(TRUE(),
max(ManuelFile_FDV) IN { "Retail" ,"Drive"} && max(QualifMono) = "Innos Pro", 'Inno RS",
max(ManuelFile_FDV) = "XCAT" && max(QualifProxi) = "Innos Prio", 'Inno Proxi",
max(ManuelFile_FDV) = "PMT" && max(QualifPMTAuto) = "Innos Prio", 'Inno PMT",
max(ManuelFile_FDV) = "IC" && max(InnosMetro) = "Innos Prio", 'Inno Metro"
)

 

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.