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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Get Column Values ignoring Relationship Mapping using DAX

Hi All,

 

I have a Country table with the following values:

 

CountriesDateValues
SingaporeApr-2310
SingaporeMay-2315
Hong KongApr-2320
AustraliaMay-2325

 

I have two calendar Tables. Calendar 1 and Calendar 2. Calendar 1[Date] column has a One to Many relationship mapping with Country [Date] table. 

 

In one of the report pages, I have both the calendar tables in the filter selection. Calendar 1 [Date] is selected as Apr - 23 and Calendar 2 [Date] is selected as May - 23. I want to show the table as below. The Calendar 1 Date should be ignored and Calendar 2 Date should be considered. Please let me know if there is a way to achieve this.

 

CountriesDateValues
SingaporeMay-2315
AustraliaMay-2325
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Please try below steps:

1. below is my model

vbinbinyumsft_0-1684464086446.png

2. create a measure with below dax formula

Measure =
VAR _date1 =
    SELECTEDVALUE ( Calendar1[Date] )
VAR _date2 =
    SELECTEDVALUE ( Calendar2[Date] )
VAR _date =
    SELECTEDVALUE ( 'Country'[Date] )
VAR _val =
    SWITCH (
        TRUE (),
        ISFILTERED ( Calendar1[Date] ) && ISFILTERED ( Calendar2[Date] ), _date2,
        ISFILTERED ( Calendar1[Date] ) && NOT ( ISFILTERED ( Calendar2[Date] ) ), _date1,
        ISFILTERED ( Calendar2[Date] ) && NOT ( ISFILTERED ( Calendar1[Date] ) ), _date2,
        NOT ( ISFILTERED ( Calendar2[Date] ) ) && NOT ( ISFILTERED ( Calendar1[Date] ) ), _date
    )
RETURN
    IF ( _date = _val, 1 )

3. add two slicer with Calendar1 and Calendar2 table field, add a table visual with Country table fields, add measure into table visual filter then set and apply

 

Animation03.gif

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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
Ashish_Mathur
Super User
Super User

Hi,

Why do you have two calendar tables in the first place?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Anonymous ,

Please try below steps:

1. below is my model

vbinbinyumsft_0-1684464086446.png

2. create a measure with below dax formula

Measure =
VAR _date1 =
    SELECTEDVALUE ( Calendar1[Date] )
VAR _date2 =
    SELECTEDVALUE ( Calendar2[Date] )
VAR _date =
    SELECTEDVALUE ( 'Country'[Date] )
VAR _val =
    SWITCH (
        TRUE (),
        ISFILTERED ( Calendar1[Date] ) && ISFILTERED ( Calendar2[Date] ), _date2,
        ISFILTERED ( Calendar1[Date] ) && NOT ( ISFILTERED ( Calendar2[Date] ) ), _date1,
        ISFILTERED ( Calendar2[Date] ) && NOT ( ISFILTERED ( Calendar1[Date] ) ), _date2,
        NOT ( ISFILTERED ( Calendar2[Date] ) ) && NOT ( ISFILTERED ( Calendar1[Date] ) ), _date
    )
RETURN
    IF ( _date = _val, 1 )

3. add two slicer with Calendar1 and Calendar2 table field, add a table visual with Country table fields, add measure into table visual filter then set and apply

 

Animation03.gif

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.