Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Handling with multiple date columns in one table

Hi I have 2 tables 1) report date 2) control date 

in control date there are two date columns 1) control date 2) submitted date

for example if I select the jan month from report table the control date and submitted should call in same range and should display jan month from control date and jan month in submitted date.for this result I can write dax where control date year month and submitted year month is equal, but if I select multiple dates and if the date is in below way

ID  control date    Submitted date 

1.      march 3 2021   April 4 2021

2.      sept 6 2021       Oct 5 2021

if I select report date as march and April the first row has to display  and if I select march and oct then not to display any thing 

 

I hope you understand guys if any one can you please help me out that would be great 

  • Hi Anonymous ,

    According to your description, I create a sample.

    This is Control date table, the two columns are all of date type.

    This is Report date table.

    Here's my solution.

    1.In Power Query, add a index column for the Report date table.

    2.Create a measure.

    Check =
    IF (
        MONTH ( MAX ( 'Control date'[Control date] ) ) <= MIN ( 'Report date'[Index] )
            && MONTH ( MAX ( 'Control date'[Submitted date ] ) )
                >= MAX ( 'Report date'[Index] ),
        1,
        0
    )
    

    3.Click the Control date and Submitted date visual, then put the check measure into the visual filter, select the value is 1, then click Apply filter.

    Get the expected result.

    I attach my sample below for reference.

     

    Best Regards,
    Community Support Team _ kalyj

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

     

2 Replies

  • Hi Anonymous ,

    According to your description, I create a sample.

    This is Control date table, the two columns are all of date type.

    This is Report date table.

    Here's my solution.

    1.In Power Query, add a index column for the Report date table.

    2.Create a measure.

    Check =
    IF (
        MONTH ( MAX ( 'Control date'[Control date] ) ) <= MIN ( 'Report date'[Index] )
            && MONTH ( MAX ( 'Control date'[Submitted date ] ) )
                >= MAX ( 'Report date'[Index] ),
        1,
        0
    )
    

    3.Click the Control date and Submitted date visual, then put the check measure into the visual filter, select the value is 1, then click Apply filter.

    Get the expected result.

    I attach my sample below for reference.

     

    Best Regards,
    Community Support Team _ kalyj

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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you very much for this solution and I have another help where how to write dax for this based on count I mean how many are there with in the selected range