This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
I'm trying to create a new column using the SWITCH function and I'm using the DAX formula below. The issue I have is if there is a blank for Gainline Prev the DAX formula is reading it as a 0 and adding Negative GL. How do I get it to ignore cells that are blank or is there a better way of doing it?
Hi @jamieham ,
According to my understanding, you want to use switch() to create a new column and filter the blank row, right?
You could use the following formula:
Gainline =
VAR _blank =
ISBLANK ( SELECTEDVALUE ( Default[Gainline Prev] ) )
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( Default[Gainline Prev] ) = 1
&& _blank = FALSE (), "Positive GL",
SELECTEDVALUE ( Default[Gainline Prev] ) = 0
&& _blank = FALSE (), "Negative GL"
)My visualization looks like this:
Is the result what you want? If you have any questions, please upload some data samples and expected output.
Please do mask sensitive data before uploading.
Best Regards,
Eyelyn Qin
| Team | Team ID | Play Num | Set Num | PS Timestamp | PS Endstamp | Home Team | Away Team | Match Time | Half | Score_Advantage | Description | Metres | X_Coord | X_Coord End | Y_Coord | Y_Coord End | Action Type | Action Result | Gainline Next | Gainline Prev | Gainline |
| Team 1 | 500 | 3 | 103 | 7246 | 7250 | Team 1 | Team 2 | 7956 | 2 | 7 | Ruck | 0 | 82 | 0 | 8 | 0 | NA | Won Outright | 1 | 0 | Negative GL |
| Team 1 | 500 | 4 | 103 | 7257 | 7261 | Team 1 | Team 2 | 8008 | 2 | 7 | Ruck | 0 | 87 | 0 | 44 | 0 | NA | Won Outright | 1 | 1 | Positive GL |
| Team 1 | 500 | 5 | 103 | 7265 | 7269 | Team 1 | Team 2 | 8016 | 2 | 7 | Ruck | 0 | 89 | 0 | 58 | 0 | NA | Won Outright | 1 | 1 | Positive GL |
| Team 3 | 8850 | 1 | 1 | 4 | 12 | Team 3 | Team 4 | 10 | 1 | 0 | Possession | 13 | 80 | 93 | 66 | 68 | Start Set 50m Restart Retained | End Set Own Lineout | |||
| Team 3 | 8850 | 6 | 2 | 44 | 101 | Team 3 | Team 4 | 131 | 1 | 0 | Possession | 3 | 92 | 95 | 68 | 53 | Lineout | End Pen Won | |||
| Team 4 | 3000 | 2 | 4 | 164 | 178 | Team 3 | Team 4 | 257 | 1 | 0 | Possession | -1 | 5 | 4 | 0 | 11 | Start Set Lineout Steal | End Scrum |
You can create a measure like
calculate([Meausre], filter(Table, not(isblank(Table[Gainline Prev]))))
Or you can use visual level or page filter Table[Gainline Prev] <> Blank ()
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 32 | |
| 26 | |
| 21 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 63 | |
| 44 | |
| 28 | |
| 24 | |
| 22 |