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
Anonymous
Not applicable

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 

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, I create a sample.

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

vkalyjmsft_0-1644547321588.png

This is Report date table.

vkalyjmsft_1-1644547412524.png

Here's my solution.

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

vkalyjmsft_2-1644547457369.png

vkalyjmsft_3-1644547515605.png

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.

vkalyjmsft_4-1644548130189.png

Get the expected result.

vkalyjmsft_5-1644548266522.png

vkalyjmsft_6-1644548300627.png

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.

 

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, I create a sample.

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

vkalyjmsft_0-1644547321588.png

This is Report date table.

vkalyjmsft_1-1644547412524.png

Here's my solution.

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

vkalyjmsft_2-1644547457369.png

vkalyjmsft_3-1644547515605.png

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.

vkalyjmsft_4-1644548130189.png

Get the expected result.

vkalyjmsft_5-1644548266522.png

vkalyjmsft_6-1644548300627.png

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.