Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Date filter does not work inside a DAX table

I have a date table disconnected from the model.

 

I have created two measures that show the first and last date selected. These measures work and are shown on the right side of the image.

However, if I use those measures within a DAX table, they do not return the same dates, but they return the minimum and maximum dates of all the dates that I have in the date table.

Measures

 

 

MinDisconectedDate = CALCULATE ( MIN ( 'Disconnected Calendar'[Date] ); ALLSELECTED ( 'Disconnected Calendar'[Date] ) )

MaxDisconectedDate = CALCULATE ( MAX( 'Disconnected Calendar'[Date] ); ALLSELECTED ( 'Disconnected Calendar'[Date] ) )

 

 


Dax table

 

 

TEST TABLE  = 
            SELECTCOLUMNS (
                NATURALLEFTOUTERJOIN (
                    FILTER (
                        TableData;
                        TableData[EndDateTime] < [MaxDisconectedDate]
                            && TableData[StartDateTime] > [MinDisconectedDate]
                    );                    
                    ALL ( TableDataCustomer)
                );
                "Campaign"; TableData[Code];
                "MinDate"; [MinDisconectedDate];
                "MaxDate"; [MaxDisconectedDate]
            )
        

 

 



Does anyone know what may be happening?

 

Thanks in advance

  • Hi Anonymous 

     

    Tables and Columns are static, created on Load or Refresh of the model, Measures can not change Tables or Columns.

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn

     

2 Replies

  • Mariusz's avatar
    Mariusz
    Community Champion

    Hi Anonymous 

     

    Tables and Columns are static, created on Load or Refresh of the model, Measures can not change Tables or Columns.

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      First of all, thanks for the reply.

       

      I have achieved the result I wanted by creating the table with DAX, adding the dates of the fact table with the grouping that I needed and creating a measure to filter the DAX table

       

      Thanks