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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
NeverGiveUp
Frequent Visitor

switch? Date table and Table with Date - table with date - handling null values in the table

Need something like this.... maybe a SWITCH statement?  Any help?

  1. If SOS date is not blank && Current Year Quarter is filtered then filter the table to the filtered values.
  2. If SOS date is not blank && FY Quarter is filtered then filter the table to those filtered values.
  3. If neither filter is selected, I want to see blank SOS dates included with the other data.

    Hello,

 

I have a Date Table with the Current Year and Quarters.

I have my dataset that has a relationship with the date table.

 

I have a drop down with the Quarters for this year, Q1 - Q4.

 

However, when I select Q1, not only does it return Q1, it also returns the blanks in my table.

How can I prevent this from happening?  
If I have it filtered on Q1, I only want to see Q1 data in the table.

 

A couple things I tried,

 

I tried including the SOS date  on the dropdown slicer and set it to is not blank. 

I tried creating a measure and applied it to the table and set it to 1 so that if the dropdown was filtered, it would only show filtered data.

None of this works... any ideas?

 

PS- I should also mention, if there is not a date in that specific column in my table (i.e. if it is blank), and if it the quarter is not filtered -  I still want to see those rows because there is value to see a date is not yet assigned.  Just want to throw that in there because the fix is not to exclude those rows from my dataset. 🙂

 

shows blanks too- 

myCONDITIONS_current_calendar = 
IF( ISFILTERED('CurrentYearOnlyCalendar'[Quarter Calendar Year]), 1, 0)

This only shows filtered data. But requires selection to show data

 

myCONDITIONS_current_calendar =

 var selected_qtr = SELECTEDVALUE('CurrentYearOnlyCalendar'[Quarter Calendar Year])

VAR conditionsmetcurrent =if(MIN('PCMerge'[dsbp_initiative_start_of_shipment]) <> BLANK() && ISFILTERED('CurrentYearOnlyCalendar'[Quarter Calendar Year]), 1, 0)

RETURN

conditionsmetcurrent

 

 

This kinda works but not fully

 

myCONDITIONS_current_calendar =

IF(MIN('PCMerge'[dsbp_initiative_start_of_shipment]) <> BLANK(),

SWITCH( TRUE(),

 ISFILTERED('CurrentYearOnlyCalendar'[Quarter Calendar Year]), 1,

 ISFILTERED('SOSCalendar'[FY Quarter]), 2, 3), 3)

 
 
updated_ help_blanks.jpg
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @NeverGiveUp ,

Please update the formula of measure [myCONDITIONS_current_calendar] as below and check if it can return the expected result...

myCONDITIONS_current_calendar =
VAR selected_qtr =
    ISFILTERED ( 'CurrentYearOnlyCalendar'[Quarter Calendar Year] )
VAR selected_fyqtr =
    ISFILTERED ( 'SOSCalendar'[FY Quarter] )
VAR sosdate =
    SELECTEDVALUE ( 'PCMerge'[dsbp_initiative_start_of_shipment] )
RETURN
    IF ( NOT ( ISBLANK ( sosdate ) ) && ( selected_qtr || selected_fyqtr ), 1, 0 )

If the above one can't help you, please provide some raw data in your tables  'CurrentYearOnlyCalendar','PCMerge' and 'SOSCalendar' (exclude sensitive data) with Text format and your expected result with backend logic and special examples? By the way, is there any relationship among these three tables? If yes, please also provide the related info. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @NeverGiveUp ,

Please update the formula of measure [myCONDITIONS_current_calendar] as below and check if it can return the expected result...

myCONDITIONS_current_calendar =
VAR selected_qtr =
    ISFILTERED ( 'CurrentYearOnlyCalendar'[Quarter Calendar Year] )
VAR selected_fyqtr =
    ISFILTERED ( 'SOSCalendar'[FY Quarter] )
VAR sosdate =
    SELECTEDVALUE ( 'PCMerge'[dsbp_initiative_start_of_shipment] )
RETURN
    IF ( NOT ( ISBLANK ( sosdate ) ) && ( selected_qtr || selected_fyqtr ), 1, 0 )

If the above one can't help you, please provide some raw data in your tables  'CurrentYearOnlyCalendar','PCMerge' and 'SOSCalendar' (exclude sensitive data) with Text format and your expected result with backend logic and special examples? By the way, is there any relationship among these three tables? If yes, please also provide the related info. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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