Forum Discussion
If statement doesn't allow to select columns
- Anonymous6 years ago
Hi Anonymous,
What the 'blank' means? 'blank' text or null value? If you mean the null value, you can use camargos88 's suggestion. For 'blank' text, you need to change the conditions to compare with 'blank'.
Measure = VAR qtReceiver = SELECTEDVALUE ( 'Table'[QT received] ) VAR _status = SELECTEDVALUE ( 'Table'[Status] ) RETURN IF ( qtReceiver = "blank" && _status = "Closed", 1, 0 )BTW, the above formula not suitable to use to compare with summarize row contents. For this scenario, you can try to use the following measure formula:
Measure = VAR summary = SUMMARIZE ( Table, [Name], [QT Receive], [Status], "If statement", IF ( [QT Receive] = "Blank" && _status = "Closed", 1, 0 ) ) RETURN CONCATENATEX ( summary, [If statement], "," )Regards,
Xiaoxin Sheng
Within a measure, you need to wrap a column reference in an aggregator like SUM, COUNT, MAX, MIN, AVERAGE, etc.
Thank you for you quick ansawer Greg_Deckler !
I see but in my case, I don't know how to aggregate.
Indeed I have the data below and I would like to measure IF QT received is Blank and Status closed then 0 otherwise 1.
| Name | QT received | Status | If statement |
| X | blank | Closed | 0 |
| Y | 1 | Open | 1 |
| Z | 0 | Open | 1 |
- Greg_Deckler6 years ago
Community Champion
camargos88 's formula should work. I generally just use MAX instead of SELECTEDVALUE but same kind of thing.
- Anonymous6 years agoNot applicable
Hi Anonymous,
What the 'blank' means? 'blank' text or null value? If you mean the null value, you can use camargos88 's suggestion. For 'blank' text, you need to change the conditions to compare with 'blank'.
Measure = VAR qtReceiver = SELECTEDVALUE ( 'Table'[QT received] ) VAR _status = SELECTEDVALUE ( 'Table'[Status] ) RETURN IF ( qtReceiver = "blank" && _status = "Closed", 1, 0 )BTW, the above formula not suitable to use to compare with summarize row contents. For this scenario, you can try to use the following measure formula:
Measure = VAR summary = SUMMARIZE ( Table, [Name], [QT Receive], [Status], "If statement", IF ( [QT Receive] = "Blank" && _status = "Closed", 1, 0 ) ) RETURN CONCATENATEX ( summary, [If statement], "," )Regards,
Xiaoxin Sheng
- riteshsen1 year agoRegular Visitor
This worked! Thanks!...
- camargos886 years ago
Community Champion
Anonymous ,
Try creating this measure:
Measure =VAR _qtReceived = SELECTEDVALUE('Table'[QT received])VAR _Status = SELECTEDVALUE('Table'[Status])RETURN IF(_qtReceived = BLANK() && _Status = "Closed"; 0; 1)Ricardo