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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.