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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
abcd
Frequent Visitor

Filter visual based on an inactive relationship

I have a number of measures that take inactive relationships into account when it comes to dates. I have one "Calendar" table that is linked to many date columns, inactively, and the measures just calculate according to the relationship I've pointed them at in order to have a date slicer. It works great.

 

But how do I make this date slicer work when I don't actually need a measure?

 

I have a table that has rows showing a particular assessment an employee has given to a volunteer, across different skill categories, and on what date they made the assessment.

My aim is to have a pivot table that has the employee on the row labels, the skill categories for the columns, and a count of the assessments as the values. It will do this without any measures involved, just the raw columns.

BUT I only want it to count the values that fall inside the date slicer. In short, I want it to take the inactive date relationship into account before it pivots.

 

Is there a way to do this?

1 ACCEPTED SOLUTION
vanessafvg
Super User
Super User

are you able to share your model or some dummy data.

you are doing a count therefore you are using a measure, you need to calculate that count with the userelationship() function which will force the inactive relationship to be counted with the correct date.

this is a good article that goes through a few scenarios

https://www.sqlbi.com/articles/userelationship-in-calculated-columns/






If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
GraysonBishop
New Member

Disclaimer: I know this isn't an efficient solution and it isn't feasible with large datasets, but I couldn't come up with anything better 🤔

 

@abcd, I was able to avoid this ambiguity issue by just making a duplicate query of my target table (e.g. "employeeAssements" in your example)... then I can have an active relationship with the duplicate without worrying about ambiguity

v-rzhou-msft
Community Support
Community Support

Hi @abcd 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Rico Zhou

v-rzhou-msft
Community Support
Community Support

Hi @abcd 

If you don't want to use measure, I think you need to build relationships between your calendar table and other tables.

Due to I don't know your data model, I build sample tables to have a test.

1.png

Calendar Table:

 

Calendar = CALENDAR(DATE(2020,01,01),DATE(2020,02,29))

 

Build relationships between date columns in two tables.

2.png

You want a Pivot table, I think build a Matrix can achieve your goal. You need to Add Employee and Category in Rows and Assessment in Values. You need to turn off Step layout in Row headers.

5.png

Result is as below.

Default:

3.png

Show Assessments between 2020/1/1 and 2020/1/10.

4.png

For more info to Relationships and Matrix: 

Model relationships in Power BI Desktop

Create matrix visualizations in Power BI

If this reply still couldn't help you please show me more details about your data model and the result you want.

Or you can provide me with your pbix file by your OneDrive for Business.

You can download the pbix file from this link: Filter visual based on an inactive relationship

 

Best Regards,

Rico Zhou

 

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

vanessafvg
Super User
Super User

are you able to share your model or some dummy data.

you are doing a count therefore you are using a measure, you need to calculate that count with the userelationship() function which will force the inactive relationship to be counted with the correct date.

this is a good article that goes through a few scenarios

https://www.sqlbi.com/articles/userelationship-in-calculated-columns/






If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors