Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
How do I write this in proper DAX?
So far I´ve tested several methods - but I always get an error or an syntax-error
Solved! Go to Solution.
Cleaning up your mismatching parentheses and using a variable, you can write your formula like this:
Test =
VAR _KPI = SELECTEDVALUE ( 'FaktKPI'[BewertungKPI] )
RETURN
IF (
ISBLANK ( _KPI ),
BLANK (),
IF (
ISNUMBER ( _KPI ),
_KPI,
"yes"
)
)
This can be further simplified as
Test =
VAR _KPI = SELECTEDVALUE ( 'FaktKPI'[BewertungKPI] )
RETURN
IF ( ISBLANK ( _KPI ) || ISNUMBER ( _KPI ), _KPI, "yes" )
However, you're still likely to have a problem since IF cannot output text in some cases and numbers in other cases. It has to output the same data type for both cases. Thus you need to either format your number as text or else use a number instead of "yes". For example, if you want to show your KPI as a percentage with two decimal places, you could use FORMAT to convert the number to text like this:
Test =
VAR _KPI = SELECTEDVALUE ( 'FaktKPI'[BewertungKPI] )
RETURN
IF (
ISBLANK ( _KPI ) || ISNUMBER ( _KPI ),
FORMAT ( _KPI, "0.00%" ),
"yes"
)
Thank you very much!
Cleaning up your mismatching parentheses and using a variable, you can write your formula like this:
Test =
VAR _KPI = SELECTEDVALUE ( 'FaktKPI'[BewertungKPI] )
RETURN
IF (
ISBLANK ( _KPI ),
BLANK (),
IF (
ISNUMBER ( _KPI ),
_KPI,
"yes"
)
)
This can be further simplified as
Test =
VAR _KPI = SELECTEDVALUE ( 'FaktKPI'[BewertungKPI] )
RETURN
IF ( ISBLANK ( _KPI ) || ISNUMBER ( _KPI ), _KPI, "yes" )
However, you're still likely to have a problem since IF cannot output text in some cases and numbers in other cases. It has to output the same data type for both cases. Thus you need to either format your number as text or else use a number instead of "yes". For example, if you want to show your KPI as a percentage with two decimal places, you could use FORMAT to convert the number to text like this:
Test =
VAR _KPI = SELECTEDVALUE ( 'FaktKPI'[BewertungKPI] )
RETURN
IF (
ISBLANK ( _KPI ) || ISNUMBER ( _KPI ),
FORMAT ( _KPI, "0.00%" ),
"yes"
)
Test =
IF (
NOT ISBLANK ( SELECTEDVALUE ( 'FaktKPI'[BewertungKPI] ) ),
IF (
ISNUMBER ( SELECTEDVALUE ( 'FaktKPI'[BewertungKPI] ) ),
SELECTEDVALUE ( FaktKPI[BewertungKPI] ),
"yes"
)
)
User | Count |
---|---|
12 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
24 | |
19 | |
14 | |
10 | |
7 |