Forum Discussion
jananagarajan
3 years agoRegular 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 ID | Temp | Value | Calculation |
| T02 | 35 | 55 | |
| T03 | 27 | 50 | 100% |
| T06 | 29 | 49 | 98% |
| T01 | 33 | 48 | 96% |
| T04 | 28 | 47 | 94% |
| T05 | 27 | 46 | 92% |
| T01 | 35 | 45 | 90% |
| T02 | 26 | 44 | 88% |
| T03 | 34 | 43 | 86% |
| T01 | 31 | 41 | 82% |
| T05 | 31 | 40 | 80% |
| T01 | 31 | 39 | 78% |
| T02 | 31 | 38 | 76% |
| T06 | 35 | 37 | 74% |
| T04 | 26 | 36 | 72% |
| T05 | 28 | 34 | 68% |
| T02 | 33 | 32 | 64% |
| T01 | 26 | 31 | 62% |
| T03 | 28 | 30 | 60% |
| T02 | 32 | 30 | 60% |
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.
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%" ) )
3 Replies
- Jihwan_Kim
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.
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%" ) )- jananagarajanRegular Visitor
I am getting the result in text format not able to change and only 100% is getting displayed here.
- jananagarajanRegular Visitor
Thank you