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
tkrupka
Resolver II
Resolver II

DAX If And Filter

I am trying to figure out how to do this.  Basically I am trying to write a DAX equation that will allow me to create a measure with multiple filters.

 

DAX question.JPG

 

I want to get the Tanks[Tank_Name] where Tanks[Day_Tank]=FALSE && Tanks[INDEX]=MIN(Tanks[INDEX]) following the Day Tank filter

 

i.e.  if Day_Tank=FALSE, Lookup Tank_Name where Index is smallest value.

 

The reason for this is because I am going to have visuals on the same dashboard where Day_Tank = True and Day_Tank = FALSE

I've been playing around with this for a few days now without success.

1 ACCEPTED SOLUTION

Finally figured out what I wanted.  I'm not sure why I was having such an issue.

 

Day_Tank_1 = CALCULATE(VALUES(Tanks[Tank_Name]),FILTER(Tanks,Tanks[Day_Tank]=TRUE()),FILTER(Tanks,Tanks[INDEX]=1))

View solution in original post

9 REPLIES 9
parry2k
Super User
Super User

@tkrupka if you share sample data with expected result it will help to provide the solution. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Sample Data.JPG

@parry2k IF Fourth column = TRUE / FALSE depending on the situation, give me the 2nd column where the last column is the smallest value.

 

@tkrupka minimum of last column against whole dataset or what?? Can you clarify? 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2kLet's say I wanted to get DC4-Tank A as my result.  

 

The visuals are already set to a page filter of DC4, so that gets rid of the DC2 results.

 

If I filter to Day_Tank = TRUE, I now have seven results

 

Now the minimum value of INDEX of that filter would give me my expected result.

@tkrupka so basically you need minimum of index on allselected records

 

Minimum Index = 
CALCULATE( MIN(Table[Index]) , ALLSELECTED( Table ) )

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2kBut I also need to filter based on the Day Tank value because some visuals will be based on TRUE and others will be based on FALSE on the same dashboard.

@tkrupka I would recommend put your data in excel sheet and required result in a seperate sheet to get you the solution. I sent you an post before on how to get answer quickly, hope you already read it. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Finally figured out what I wanted.  I'm not sure why I was having such an issue.

 

Day_Tank_1 = CALCULATE(VALUES(Tanks[Tank_Name]),FILTER(Tanks,Tanks[Day_Tank]=TRUE()),FILTER(Tanks,Tanks[INDEX]=1))

@parry2k I haven't seen it.

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.