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

Data Model - switch relation from inactive to active by condition.

Hi All,
I need your help in switch relation from inactive to active by condition.

 

I have 4 tables.


tabe 1:
table 1.JPG

table 2:

table 2.JPG

table 3:

table 3.JPG

filter:

filter.JPG

Data Model:

POWER BI - RELATIONS.JPG

 

dashboard:

dashboard.JPG

 

I need to switch  filter from table 1 to table 2 according filter selection

 

link: Power BI WorkSpace

 

Hope for your help

 

Tks,

Idan

 

19 REPLIES 19
Greg_Deckler
Super User
Super User

USERELATIONSHIP

 

https://docs.microsoft.com/en-us/dax/userelationship-function-dax


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi Greg,
Tks For your respond.
I saw USERELATIONSHIP Function Before I posted.


I didn't understand how to use it.
1.Where to put it -> table Active or table Inactive
2.This function need Calculate formula -> However I don't have anything to put in

3.Is a Measure or calculated column ?

 

 If you can, Pls help me to build the formula

 

Tks A lot 

 

Regards,
Idan

Quick question, why can't you just Append your Table1 and Table2 so that you eliminate the issue?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

In this case I just simplified my tables.
In reality I've 2 fact tables contain 500K Rows Each and I want to add filter which filter both.

 

Thank you Greg for your kindness

 

Idan

 

 

Hi @Anonymous

 

You may set the relationships as inactive. Then create the measures with USERELATIONSHIP Function. For example:

Index1 = CALCULATE(SUM(Table1[index]),USERELATIONSHIP(Table1[index],'filter'[index]))
Index2 = CALCULATE(SUM(Table2[index]),USERELATIONSHIP('filter'[index],Table2[index]))

Attached the sample file for your reference. Below are some articles for you. Please understand that this link is provided “AS IS” with no warranties or guarantees of content changes, and confers no rights.

https://www.kasperonbi.com/dynamic-data-comparisons-using-disconnected-slicers-treatas-and-inactive-relationships/

http://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in-power-bi

 

Regards,

Cherie

 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Cherie,
Tks for your quick respond 🙂

The solution not solved all the issue.
When I am choosing filter category from filter Table then Table 3 not respond.

 

Idan

Hi @Anonymous

 

You may use the same way as below: 1. Add relationship between filter and table3  2.Create a measure Score1

Score1 = CALCULATE(SUM(Table3[score]),USERELATIONSHIP('filter'[category],Table3[category]))

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Cherie,
I tried to apply this method on real data and it doesn't work.

I upload my real data file contain only relevant information.

Pls take as show in real data sheet - link

 

Hope for your respond.

 

Tks,
Idan

Hi @Anonymous

 

I may not have access to view it. Could you provide the .pbix file? You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous

 

It seems you may use the visual level filter.

1.png

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

we still have one table missing through filter selection - link

Hi @Anonymous

 

Which table is missing ? If you use userelationship fuction, please use the measure in the table visual or visual level filter.

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

I tried to put the measure in the table visual or visual level filter but it isn't work.

 

pls see the link

Hi @Anonymous

 

I have no access to view it. Please check the updated file and let me know if it matches your request. If not, please let me know which table is not correct.

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Cherie,
I can't aggregate the data  - attach: Real Data Part 2 Sheet
I tried count default option, calculated column, measure - not work

 

If you can't open the attached so pls

focus on Table : score summary table by license

create column with random number 1-10
then, try to count license by this column. example:


Rand column  |    count of license column

     1                                 100 

     2                                 199

     3                                 39

     .

     .

     .

    9                                 10

   10                                20

 

 

hope for your respond

 

Idan

 

Hi @Anonymous

 

You may change the filter to 'is not blank' if the count number is not 1.

1.png

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Cherie ,
I tried .
not working

 

power bi - issue.JPG

 

 

attach - link

 

Idan

 

 

Anonymous
Not applicable

Because security issues I can't share it on One Drive or Drop Box.
I Sent link from Gmail Drive.

 

Why can't you see the file which link for power bi service ? (as I sent before )

 

Idan

Anonymous
Not applicable

Pls Try it - link

 

idan

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.