The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have tried to do a dax with switch but does not seem to be working with value under och over.
Anyone have any ideas to do it better?
[Status] =
SWITCH(
TRUE(),
'table'[InvestigationID] = 0 && 'table'[DecisionID] > 0, "Notification One - investigation not opened",
'table'[DecisionID] = > 0, "Notification two - Decision not to open investigation",
'table'[InvestigationID] = > 0, "Actualizations processed",
'table'[InvestigationID] = 0, "New actualizations",
"Closed actualizations"
)
Solved! Go to Solution.
Thanks for the reply from @Jihwan_Kim , please allow me to provide another insight:
Hi @MickeLearnPBI ,
Based on your description, the calculated column created, refer to the following:
Status =
SWITCH(
TRUE(),
Notifications[InvestigationID] = 0 && Notifications[DecisionID] > 0, "Notification One - investigation not opened",
Notifications[DecisionID] > 0, "Notification two - Decision not to open investigation",
Notifications[InvestigationID] > 0, "Actualizations processed",
Notifications[InvestigationID] = 0, "New actualizations",
"Closed actualizations"
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply from @Jihwan_Kim , please allow me to provide another insight:
Hi @MickeLearnPBI ,
Based on your description, the calculated column created, refer to the following:
Status =
SWITCH(
TRUE(),
Notifications[InvestigationID] = 0 && Notifications[DecisionID] > 0, "Notification One - investigation not opened",
Notifications[DecisionID] > 0, "Notification two - Decision not to open investigation",
Notifications[InvestigationID] > 0, "Actualizations processed",
Notifications[InvestigationID] = 0, "New actualizations",
"Closed actualizations"
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks! That worked like a charm 👍
Hi, I guess you are trying to create a calculated column?
Please try something like below whether it suits your requirement.
[Status] =
SWITCH (
TRUE (),
'table'[InvestigationID] = 0
&& 'table'[DecisionID] > 0, "Notification One - investigation not opened",
'table'[DecisionID] >= 0, "Notification two - Decision not to open investigation",
'table'[InvestigationID] >= 0, "Actualizations processed",
'table'[InvestigationID] = 0, "New actualizations",
"Closed actualizations"
)
That almost worked. It seems that when I use this below i only get the two first results in the new column =
'table'[InvestigationID] = 0
&& 'table'[DecisionID] > 0, "Notification One - investigation not opened",
'table'[DecisionID] >= 0, "Notification two - Decision not to open investigation",
[Status] =
SWITCH (
TRUE (),
'table'[InvestigationID] = 0
&& 'table'[DecisionID] > 0, "Notification One - investigation not opened",
'table'[DecisionID] >= 0, "Notification two - Decision not to open investigation",
'table'[InvestigationID] >= 0, "Actualizations processed",
'table'[InvestigationID] = 0, "New actualizations",
"Closed actualizations"
)
Can i get all results in the same column somehow?
Hi,
I do not know well about your business logic, but please try writing down all conditions... something like below?
[Status] =
SWITCH (
TRUE (),
'table'[InvestigationID] = 0
&& 'table'[DecisionID] > 0, "Notification One - investigation not opened",
'table'[InvestigationID] < 0
&& 'table'[DecisionID] >= 0, "Notification two - Decision not to open investigation",
'table'[InvestigationID] >= 0
&& 'table'[DecisionID] < 0, "Actualizations processed",
'table'[InvestigationID] = 0
&& 'table'[DecisionID] < 0, "New actualizations",
"Closed actualizations"
)
User | Count |
---|---|
28 | |
10 | |
8 | |
6 | |
5 |
User | Count |
---|---|
34 | |
13 | |
12 | |
9 | |
7 |