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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
José2410
Regular Visitor

relationship between table and visual with 2 different dates

Hello,

I am facing a problem. I am working on a contracts dashboard. For this I am using 2 dates. One date is the end date of the contract, the other date is when a contract should be renewed. Now I managed to get both dates in a bar chart with the userelationship formula in dax.

Jos2410_0-1717398617140.png

 

The only problem is that the table that comes with it does not filter with it, when I select the renewal date. It uses the active relation between date and Enddate.
In my bar chart I want to be able to click on both dates and the table will change with the clicked date. One time the end date, the other time the renewal date.

 

Hopefully you can help me!

 

This is the data I used:

 

I used this table:

end daterenewal datecontract number
6/30/20246/1/2024A1
7/14/20246/14/2024A2
6/20/20246/1/2024A3
7/30/20247/3/2024A4
7/4/20247/3/2024A5
7/30/20246/30/2024A6

 

And this query for a date table (you can paste this in Advanced editor):

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dY5LCsAwCAXv4jqQ56fp2nOI979GidA2pWQ5MswzghQdowvEqBF4AWfKFsTWcd63Ca8gJci+oCXMiacAXcCtBNhWOP6Fz8c+KPMC", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"End date" = _t, #"Renewal date" = _t, #"Contract number" = _t]),
#"Changed Type with Locale" = Table.TransformColumnTypes(Source, {{"End date", type date}}, "en-GB"),
#"Changed Type with Locale1" = Table.TransformColumnTypes(#"Changed Type with Locale", {{"Renewal date", type date}}, "en-GB")
in
#"Changed Type with Locale1"

 

After that I made a relation between 'date' and 'end date'. 

After that I made a measure like this: 

Count Renewal Date =
CALCULATE (
    COUNTROWS ( Dates ),
    USERELATIONSHIP ( Dates[Renewal date], 'Calendar'[Date]))
1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @José2410,

According to your description and sample data, it seems like a common multiple date fields analysis requirement.
For this scenario, I'd like to suggest you take a look at Greg’s blog to know how to handle with date range analysis requirement.

Before You Post, Read This: start, end date 

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI @José2410,

According to your description and sample data, it seems like a common multiple date fields analysis requirement.
For this scenario, I'd like to suggest you take a look at Greg’s blog to know how to handle with date range analysis requirement.

Before You Post, Read This: start, end date 

Regards,

Xiaoxin Sheng

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.