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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
conniedevina
Helper I
Helper I

To connect date with different datekey from same table

Hi, 

 

I am having this kind of fact_table

IDcategory_acategory_bcategoryA_datecategoryB_date
12345healthynon-healthy2024-01-012024-03-01
12345sickhealthy2024-05-012024-06-01
12344very healthynon-healthy2024-03-012024-05-01

 

then I will have a date_table

Date

2024-01-01

2024-01-02

2024-01-03

 

and so on for all dates, to use this date_table as slicer

 

Is it possible using DAX to connect this date_table slicer to different column of date in fact_table?

I will have 2 charts based on category_a and category_b

 

if I select 2024-03-01

chart category_a will show very healthy

chart category_b will show non-healthy

2 ACCEPTED SOLUTIONS
Royel
Impactful Individual
Impactful Individual

Hi @conniedevina  yes it is possible to connect different data columns for certain calculation using DAX USERELATIONSHIP functions 

 

Results: 

Royel_1-1759309786163.png

 

Model Relationships:

DateTable[Date] = CategoryA_Date (Active)

DateTable[Date] = CategoryB_Date (In-Active)

Royel_3-1759310033110.png

 

Dax: 

CategoryA = 
CALCULATE (
SELECTEDVALUE ( fact_table[category_a] )
)

CategoryB = 
CALCULATE (
SELECTEDVALUE ( fact_table[category_b] ),
USERELATIONSHIP ( fact_table[categoryB_date], DateTable[Date] )
)

 

Small Correction: Your Date table date format are not same as Fact table (CategoryA_Date, CategoryB_Date)

Here is corrected date for fact table 

Royel_2-1759309910560.png

 

Find this helpful? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

danextian
Super User
Super User

Hi @conniedevina 

You can create only one active relationship between two tables (if that doesn't result to an ambiguous relationship path with other tables) but you can have more inactive relationships. Inactive relationships can be invoked via measure using USERELATIONSHIP function

danextian_0-1759321061608.png

The image below shows a single date column but returns different values depending on which inactive relationship is invoked.

danextian_1-1759321141747.png

Please see the attached pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @conniedevina 

You can create only one active relationship between two tables (if that doesn't result to an ambiguous relationship path with other tables) but you can have more inactive relationships. Inactive relationships can be invoked via measure using USERELATIONSHIP function

danextian_0-1759321061608.png

The image below shows a single date column but returns different values depending on which inactive relationship is invoked.

danextian_1-1759321141747.png

Please see the attached pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Royel
Impactful Individual
Impactful Individual

Hi @conniedevina  yes it is possible to connect different data columns for certain calculation using DAX USERELATIONSHIP functions 

 

Results: 

Royel_1-1759309786163.png

 

Model Relationships:

DateTable[Date] = CategoryA_Date (Active)

DateTable[Date] = CategoryB_Date (In-Active)

Royel_3-1759310033110.png

 

Dax: 

CategoryA = 
CALCULATE (
SELECTEDVALUE ( fact_table[category_a] )
)

CategoryB = 
CALCULATE (
SELECTEDVALUE ( fact_table[category_b] ),
USERELATIONSHIP ( fact_table[categoryB_date], DateTable[Date] )
)

 

Small Correction: Your Date table date format are not same as Fact table (CategoryA_Date, CategoryB_Date)

Here is corrected date for fact table 

Royel_2-1759309910560.png

 

Find this helpful? ✔ Give a Kudo • Mark as Solution – help others too!

grazitti_sapna
Super User
Super User

Hi @conniedevina,

 

Yes, it's possible, you can create two relationships with calendar table with different dates in your fact table.

One should be active and another should be a Inactive relationship.

Now for relationship with date which is active you can create a simple calculation and use it.

But for the relationship where the relationship is active you can use function USERELATIONSHIP in your measure, this makes the inactive relationship to act as a active relationship.

 

For e.g.

 

CategoryA_Selected =
CALCULATE (
SELECTEDVALUE ( fact_table[category_a] )
)

 

CategoryB_Selected =
CALCULATE (
SELECTEDVALUE ( fact_table[category_b] ),
USERELATIONSHIP ( fact_table[categoryB_date], DateTable[Date] )
)

 

🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors