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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
c_d_m
New Member

DAX when slicer is not selected then null

I have a direct query to my data set yet I need the follwoing:

When there is no value selected in the slicer for example when there is no date selected or there is no customer number selected then my table should rest in null and only show values if the user selects a date and a customer number. 

Thanks

1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

Assuming you have a date slicer and a customer number slicer, and you want your table to show values only when both a date and a customer number are selected, you can create a measure that checks if the slicers have selections and then display the values accordingly.

Here's an example of how you might structure your DAX measure:

 

YourMeasure =
IF (
ISFILTERED('DateTable'[DateColumn]) && ISFILTERED('CustomerTable'[CustomerNumberColumn]),
-- Show your values here when both slicers are selected
SUM('YourDataTable'[YourValueColumn]),
-- Show null when either or both slicers are not selected
BLANK()
)

 

In this example:

  • 'DateTable'[DateColumn] and 'CustomerTable'[CustomerNumberColumn] are the columns from your date and customer tables that correspond to the slicers.
  • 'YourDataTable'[YourValueColumn] is the column in your data table that you want to display when both slicers are selected.

This DAX measure checks if both slicers are filtered (ISFILTERED function) and, if so, displays the sum of your values; otherwise, it displays BLANK().

You can adjust this DAX code based on your specific data model and column names. Remember to replace the placeholder table and column names with your actual table and column names.

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

View solution in original post

1 REPLY 1
123abc
Community Champion
Community Champion

Assuming you have a date slicer and a customer number slicer, and you want your table to show values only when both a date and a customer number are selected, you can create a measure that checks if the slicers have selections and then display the values accordingly.

Here's an example of how you might structure your DAX measure:

 

YourMeasure =
IF (
ISFILTERED('DateTable'[DateColumn]) && ISFILTERED('CustomerTable'[CustomerNumberColumn]),
-- Show your values here when both slicers are selected
SUM('YourDataTable'[YourValueColumn]),
-- Show null when either or both slicers are not selected
BLANK()
)

 

In this example:

  • 'DateTable'[DateColumn] and 'CustomerTable'[CustomerNumberColumn] are the columns from your date and customer tables that correspond to the slicers.
  • 'YourDataTable'[YourValueColumn] is the column in your data table that you want to display when both slicers are selected.

This DAX measure checks if both slicers are filtered (ISFILTERED function) and, if so, displays the sum of your values; otherwise, it displays BLANK().

You can adjust this DAX code based on your specific data model and column names. Remember to replace the placeholder table and column names with your actual table and column names.

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

Helpful resources

Announcements
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.

Top Solution Authors