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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

DAX measure IF statement returning unexpected rows on ELSE

Hi all,

I am trying to understand how Power BI is working in this scenario.

I have a "Project" table joined to a "Tasks" table one a one to many relationship on the project ID

 

I have a slicer on the page, selecting the project.

 

I have a table, where I need to show l by row the status of several fields.

 

For this scenario, I am just using a simple IF statement.  With the first example below, I am not using the "Else" part of the clause and the query is filtering correctly.  Note the two rows with no value returned

 

Redback971_0-1645661903178.png

 

Now, if I add the "ELSE" part in. The table is now returning every record, but not matching anything.

 

Redback971_1-1645662077649.png

 

Can anyone please explain what is going on here?  This makes no sense to me

(note: i know there are other and probably better ways to achieve this, but I want to understand why this partiuclar scenario behaves like it does, I cannot find an answer)

thanks

4 REPLIES 4
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

I guess "EXTAG#" and "As received test" columns are not in the same table, if you don't put the measure 

m_as_received_flag in the visual, the two columns will only diplay rows has value, when you add a value in the IF ELSE part, the correspondence between the two columns has changed, it makes each correspondence have a value and can display.
 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

No, they are in the same table.

TheoC
Super User
Super User

Hi @Anonymous 

 

The IF statement is based on what exists in the "As Received Text" field.  In your second snippet, there are no values (i.e. it's blank) therefore the "Else" kicks in which is "WTF".   In your first image, you have 1 in there, therefore, you the IF = 1 is TRUE, therefore, output is "Complete".

 

If there is additional data, please provide. However, looking at the two images and the outputs, the logic seems to flow as would be expected.

 

Hope this makes sense?


Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Anonymous
Not applicable

Hi Theo,

Look at the first image.  There are only two rows where the "As received" value is not 1.  (they are zero)

and there are only 15 records in total.

 

In the second image, every single record now has the "As received" value as null.  The filter context is some reason no longer applying and every single record in the database is being returned.

This only happens after I add the "else" part.

 

I would have expected the second image to match the first image, but the original two records not matching should now have "WTF".  Not the whole dataset.

 

This is what I am not understanding.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.