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
nkasdali
Employee
Employee

Dax calculated column with IF

Hi All,

I need your help in dax matters.

 

I'm trying to add a column into my dataset as flag to identify if my value is greater then the Percentil if this same value : here my dax

 

QuadrantTurnover V2 = 
Var vTurn = Data[Turnover/Month] //default field in my table
var vPerc = CALCULATE(PERCENTILE.INC(Data[Turnover/Month];0,8);ALLEXCEPT('Data';Data[EAN];'Data'[Country];Data[Product];'Data'[Time Period]))
return 
IF(vTurn>vPerc;"TOP";"BOTTOM")

and honestly, i can't understand the result ! :

PercentileTurnover is a measure  : 

CALCULATE(PERCENTILE.INC(Data[Turnover/Month];0,8);ALLEXCEPT('Data';Data[EAN];'Data'[Country];Data[Product];'Data'[Time Period]))

Capture.JPG

 

what i'am doing wrong ?

thanks for your help 🙂

 

5 REPLIES 5
v-cherch-msft
Employee
Employee

Hi @nkasdali 

You may create the measure like below:

QuadrantTurnover V2 =
VAR vTurn =
    SUM ( Data[Turnover/Month] ) 
VAR vPerc =
    CALCULATE (
        PERCENTILE.INC ( Data[Turnover/Month]; 0,8 );
        ALLEXCEPT (
            'Data';
            Data[EAN];
            'Data'[Country];
            Data[Product];
            'Data'[Time Period]
        )
    )
RETURN
    IF ( vTurn > vPerc; "TOP"; "BOTTOM" )

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

hi @v-cherch-msft 

i thought about the measure, but, i'll lose the flag after ! i want to use the field as slicer.

 

regards

Hi @nkasdali 

If you want to use the field as slicer.You may create a calculated column.

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

hi @v-cherch-msft 

that exactly what i did :), sorry i didn't mention it.

 

 

Hi @nkasdali 

Could you share some simplified assumed sample data instead of table visual to reproduce your scenario?It is very hard to provide the solution without looking at sample data.You can also upload the .pbix file to OneDrive and post the link here. Do mask sensitive data before uploading.

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.