March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi team,
I am working with two data sources simplified to the below example:
Data Source 1
Name | Team | Control 1 | Control 2 | Control 3 | Control 4 |
John Smith | A | C | C | C | |
Bob Will | A | C | C | C | |
Melissa Tom | B | C | C | C |
Data Source 2
Name | Team | Controls | Date Conducted |
John Smith | A | Control 1 | 05/2024 |
John Smith | A | Control 3 | 05/2024 |
John Smith | A | Control 3 | 06/2024 |
Bob Will | A | Control 1 | 05/2024 |
Bob Will | A | Control 2 | 06/2024 |
Melissa Tom | B | Control 1 | 05/2024 |
Melissa Tom | B | Control 1 | 05/2024 |
Melissa Tom | B | Control 2 | 06/2024 |
Melissa Tom | B | Control 4 | 06/2024 |
Data Source 1 shows a list of staff and which controls that are marked competent (C) in. Data Source 2 shows the list of staff and which controls they have conducted.
My goal here is to create a calculation that works out how many controls conducted by each staff (from Data Source 2) was those that were marked competent and incompetent (from Data Source 1).
Ultimately, I would like table visuals somewhat like the below:
Name | No. of Competent Controls Conducted | No. of Incompetent Controls Conducted | Adherance Rate |
John Smith | 1 | 2 | 33% |
Bob Will | 1 | 1 | 50% |
Melissa Tom | 3 | 1 | 75% |
Team | Adherance Rate (May 2024) | Adherance Rate (June 2024) |
A | 66% | 0% |
B | 100% | 50% |
Is this something that Power BI can support, and if so any guidance and instructions would be greatly appreciated!
Solved! Go to Solution.
Hi,
PBI file attached.
Hope this helps.
Hi Ashish,
Thank you so much for attaching your working file; definitely helpful seeing and replicating what you did!
You are welcome.
I was able to replicate your file and have everything working, but when I try to input some more data based off my actual dataset, along with a third data source I am running into some hurdles again.
I created a new forum if anyone has time to look through and advise?
Join Both Tablen on Name.
Add below column to Data Source 2 Table,
----------------------------------------------------------
Power BI File Attached - control.pbix
If I answer your question? Mark my post as a solution! Thank You!
@dcheng029First You need to Unpivot your Data Source 1.
In Power Query, Select the Control 1 to Control 4 columns.
Right-click and choose Unpivot Columns.
Rename the columns appropriately (Control and Competence)
Review the attached screenshot and pbix file.
Hope it works.
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Hey @fahadqadir3,
Thanks for the information and assistance!
I tried to follow the measures from @Shivu-2000's below comment as well as your tip to unpivot the controls columns, however when I create the table visual the numbers of Competent Controls Conducted and Incompetent Controls Conducted all seem incorrect (I am working with my true dataset which has a lot more entries within both data sources however the logic is still all the same).
Any ideas on where I have gone wrong?
Hi @dcheng029
Follow these steps as:
1. Establish Relationship between both the data sources.
2. Create new Measures as:
Competent Controls Conducted = VAR _selectedName = SELECTEDVALUE('Data Source 2'[Name]) VAR _competentControls = CALCULATE( COUNTROWS('Data Source 1'), FILTER( 'Data Source 1', 'Data Source 1'[Name] = _selectedName && 'Data Source 1'[Control 1] = "C" || 'Data Source 1'[Control 2] = "C" || 'Data Source 1'[Control 3] = "C" || 'Data Source 1'[Control 4] = "C" ) ) RETURN IF(ISBLANK(_selectedName), BLANK(), _competentControls)
Incompetent Controls Conducted = VAR _selectedName = SELECTEDVALUE('Data Source 2'[Name]) VAR _conductedControls = COUNTROWS('Data Source 2') VAR _competentControls = CALCULATE([Competent Controls Conducted]) RETURN IF(ISBLANK(_selectedName), BLANK(), _conductedControls - _competentControls)
Adherence Rate = VAR _competentControls = CALCULATE([Competent Controls Conducted]) VAR _conductedControls = CALCULATE([Incompetent Controls Conducted]) + _competentControls RETURN IF(ISBLANK(_conductedControls), BLANK(), DIVIDE(_competentControls, _conductedControls, 0))
3. Building the Visuals:
Hi @Shivu-2000,
Thanks so much for the comprehensive info; much appreciated!
The names from Data Source 1 is actually more relevant than those from Data Source 2, how would i amend the measure to use the names from Data Source 1 instead? I've tried changing from:
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
82 | |
69 | |
53 | |
44 |
User | Count |
---|---|
202 | |
106 | |
100 | |
64 | |
56 |