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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
FilipoARG
Frequent Visitor

IF in meassure with VAR

Hi, 

 

I would apreciatte some help on this. Works in my head only lol.

 

My table has:

- amount in units (Cantidad_Facturada)

- amount in kg (Kilos_Facturados)

- Business Unit (UEN)

 

I need a meassure to use different columns, depending on what UEN is:

 

 

Unidades Facturadas prueba = 
    VAR _CantFactAl = CALCULATE(SUM(Facturacion[Cantidad_Facturada]),Facturacion[UENS.UEN]="Aluminium")
    VAR _CantFactTp = CALCULATE(SUM(Facturacion[Cantidad_Facturada]),Facturacion[UENS.UEN]="Tinplate")
    VAR _CantFactPh = CALCULATE(SUM(Facturacion[Kilos_Facturados]),Facturacion[UENS.UEN]="Pharma")
    VAR _CantFactFS = CALCULATE(SUM(Facturacion[Kilos_Facturados]),Facturacion[UENS.UEN]="Food Solutions")
    VAR _CF =   IF(SELECTEDVALUE(Facturacion[UENS.UEN])="Aluminium",_CantFactAl,
                IF(SELECTEDVALUE(Facturacion[UENS.UEN])="Tinplate",_CantFactTp,
                IF(SELECTEDVALUE(Facturacion[UENS.UEN])="Pharma",_CantFactPh,
                IF(SELECTEDVALUE(Facturacion[UENS.UEN])="Food Solutions",_CantFactFS,0))))

RETURN
_CF

 

 

What am I doing wrong? doesn´t give me any error, but doesn´t give me any value also.

 

2 REPLIES 2
v-binbinyu-msft
Community Support
Community Support

Hi @FilipoARG ,

Based on your description above, it is difficult for me to determine what the problem is, please provide more detailed information, such as desensitized data and screenshots for the results you expect.

Based on your description above, I can only guess that the problem may occur in the context for the measure.

Thanks for your efforts & time in advance

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

MahyarTF
Memorable Member
Memorable Member

Hi,

Would you please share some data here ?

Mahyartf

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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