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
jananagarajan
Regular Visitor

How to write a logical if statement for the index

How to write a logical if statement for the index 

Have written the same calculation in excel and would like to write the same in DAX

IF(C3<>"",C3/$C$3,"")

 

Sample Data is attached

 

Customer IDTempValueCalculation
T023555 
T032750100%
T06294998%
T01334896%
T04284794%
T05274692%
T01354590%
T02264488%
T03344386%
T01314182%
T05314080%
T01313978%
T02313876%
T06353774%
T04263672%
T05283468%
T02333264%
T01263162%
T03283060%
T02323060%
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new column.

 

Jihwan_Kim_0-1665063139628.png

 

 

Calculation CC =
VAR _fixvalue =
    SUMX (
        FILTER ( Data, Data[Customer ID] = "T03" && Data[Temp] = 27 ),
        Data[Value]
    )
VAR _result =
    DIVIDE ( Data[Value], _fixvalue )
RETURN
    IF ( _result > 1, BLANK (), FORMAT ( _result, "#0.0%" ) )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new column.

 

Jihwan_Kim_0-1665063139628.png

 

 

Calculation CC =
VAR _fixvalue =
    SUMX (
        FILTER ( Data, Data[Customer ID] = "T03" && Data[Temp] = 27 ),
        Data[Value]
    )
VAR _result =
    DIVIDE ( Data[Value], _fixvalue )
RETURN
    IF ( _result > 1, BLANK (), FORMAT ( _result, "#0.0%" ) )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thank you

I am getting the result in text format not able to change and only 100%  is getting displayed here.

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.