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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Filter table visual with DAX

Hi! A problem I have seems to be light but strange obstacles occurred while I was trying to solve it, and so I am here asking for your help. 

 

I have a table 'DB Stores' including contact information such as owners' names, phone numbers, contact emails, and trading status information - boolean fields meaning if a corresponding service is enabled or not, e.g. "PayOutsideEnabled". In my report, I need to show in the first table only stores that have at least one enabled service and in the second table stores with no services turned on. Moreover, I should filter the values by month in "LastUpdate" field, so, actually, these tables will show the last status changes. 

I decided to write a measure with needed logic and 1/0 as output and then filter the tables by its result. The example below is a bit simplified version of my code. Actually, there are 9 enabled-ish variables.

 

Table_TurnOn =
VAR BookingTableEnabled = FIRSTNONBLANK( 'DB Stores'[BookingTableEnabled], 1)
VAR TableOrderEnabled = FIRSTNONBLANK( 'DB Stores'[TableOrderEnabled], 1)
VAR result = IF( OR(BookingTableEnabled, TableOrderEnabled) = TRUE(), 1, 0)
RETURN 
result
 
Then I filter the tables with no-code filters. 
For a code like in the example I get the right answer, ...

 

Example1.png

 

...but if I change TRUE() to FALSE() in IF's condition, I will get 

 

Example2.png for all the stores I got with the previous function.

Any ideas on how I can fix my code or filter the tables? Thank you.

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try to modify your measure as below:

 

Table_TurnOn =
VAR BookingTableEnabled = FIRSTNONBLANK( 'DB Stores'[BookingTableEnabled], 1)
VAR TableOrderEnabled = FIRSTNONBLANK( 'DB Stores'[TableOrderEnabled], 1)
VAR result = AND( OR(BookingTableEnabled, TableOrderEnabled) = TRUE(), 1, 0)
RETURN 
result

 

 

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

lbendlin
Super User
Super User

Please be more specific when you say "table" - I get confused when you mean your source data table and when you mean your table visuals.

 

Please provide sample data in usable format (not as a picture) and show the expected outcome.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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