Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Else Statement isn't working in Dax.

Hi,

 

I'm trying to run a dax statement ----->>

 

Measure 5 =
VAR SelectedState =
CALCULATE (
[Measure 3],
INTERSECT (
VALUES ( Qualifiers[State] ),
VALUES ('Table 6'[State])
)
) VAR UnSelectedState =
CALCULATE (
[DSA_FallOut],
EXCEPT (
ALLSELECTED(Qualifiers[State] ),
VALUES ( Qualifiers[State] )
)
) VAR AllState =
CALCULATE (
[DSA_FallOut]*1,
ALL(Qualifiers[State]) )
RETURN
IF (
HASONEVALUE( Qualifiers[State] ),
SWITCH(
VALUES(Qualifiers[State]),SELECTEDVALUE(Qualifiers[State]),
SelectedState,
UnSelectedState
),AllState
)

 

So if Hasonevalue() is true, it should give me the Value of "SelectedState","UnSelectedState", which is working fine but it doesn't give me "AllState" value for else statement. 

1 ACCEPTED SOLUTION
v-danhe-msft
Employee
Employee

Hi @Anonymous,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-danhe-msft
Employee
Employee

Hi @Anonymous,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-danhe-msft
Employee
Employee

Hi @Anonymous,

From your formula, if the HASONEVALUE() is false, it will give  you the "AllState" value, you could check if the formula

HASONEVALUE( Qualifiers[State] ) has the false value.

Also, could you please share a pbix to have a test if possible? You could upload your file to OneDrive or Dropbox and send the link here.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.