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 Relationship Question

Hi,

 

I have a project database, very simplistically set up as following. A 'projects' table listing all the projects, and a risk table listing risks, joined to the project table. (In reality there are many tables but this should suffice as an example)

Screenshot 2020-11-18 121812.pngI Have a programme report where a user chooses the programme they wish to view, and then the report is filtered to show projects and risks associated with that programme.

All simple and working so far. 

However...one project is now reporting under two programmes, lets call this "Project HW&SW".

How can the data or risk report be set up so that when a user selects either Hardware OR Software programme, the data associated with that project is returned.

Currently there is only one project like this, but eventually there may be more.

 

So the report would look like the following, with the Project HW&SW showing when filtering on Hardware.

 

Screenshot 2020-11-18 121851.png

 

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Projects:

e1.png

 

Risks:

e2.png

 

Slicer(a calculated table):

Slicer = DISTINCT(Projects[Programme])

 

There is a relationship between 'Projects' and 'Risks'. You may create a measure as below.

Visual Control = 
var c = 
COUNTROWS(
    FILTER(
        DISTINCT(Slicer[Programme]),
        CONTAINSSTRING(SUBSTITUTE(MAX(Projects[Project]),"Project",""),LEFT([Programme],1)&RIGHT(LEFT([Programme],5),1))
    )
)+0
return
IF(
    MAX(Projects[Programme]) in DISTINCT(Slicer[Programme]) || c>0,
    1,0
)
    

 

Then you need to put the measure in the visual level filter to filter the result.

e3.pnge4.png

 

Best Regards

Allan

 

 

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

6 REPLIES 6
Anonymous
Not applicable

Hi Allan, would you be able to explain how this works?

Hi, @Anonymous 

 

The measure checks if 'Programme' for current context is in the selected items of the slicer and if there is an item in selected items of the slicer satisfy that current item has 'Hw' or 'Sw' in 'Project' for current context. Hope it helps.

 

Best Regards

Allan

 

If this post helps,then consider Accepting it as the solution to help other members find it faster.

v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Projects:

e1.png

 

Risks:

e2.png

 

Slicer(a calculated table):

Slicer = DISTINCT(Projects[Programme])

 

There is a relationship between 'Projects' and 'Risks'. You may create a measure as below.

Visual Control = 
var c = 
COUNTROWS(
    FILTER(
        DISTINCT(Slicer[Programme]),
        CONTAINSSTRING(SUBSTITUTE(MAX(Projects[Project]),"Project",""),LEFT([Programme],1)&RIGHT(LEFT([Programme],5),1))
    )
)+0
return
IF(
    MAX(Projects[Programme]) in DISTINCT(Slicer[Programme]) || c>0,
    1,0
)
    

 

Then you need to put the measure in the visual level filter to filter the result.

e3.pnge4.png

 

Best Regards

Allan

 

 

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

amitchandak
Super User
Super User

@Anonymous , You can take out table from project table

summarize(Project, Project[projects],Project[programme]) and join with both tables. and filter

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

 

amitchandak
Super User
Super User

@Anonymous , where is that column in your data in project table ?

 

Anonymous
Not applicable

Hi Amit, which column are you asking about?

The main column of interest is the 'Programme' column as that is what is used to filter the programme report.

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.