Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
I need your expert advise on the requirement to fullfill . Could you please suggest how to achieve it.
I have a below requirement to get data from two transaction tables. Below is requirement, Data model and sample PBIX file attached.
Requirement:
I need to fetch data from two transaction tables:
1. Approved Courses- This is factless fact table, it contains Employee FK, Course FK. All courses are in this table are approved.
2. Completed Courses- This table contains Completed course information with Employee FK, course FK and complete %.
I created two Dimensions:
1. Employee Dimension
2. Course Dimension
Question1.: How to achieve below expected output?
Question2: How to get count of courses which completed? So that I can see Total Assigned(Approved) Courses and Total completed Courses all together in same table?
Model
Sample file to download:
https://1drv.ms/u/s!Al5NrA4zIB7OnEimWwJi34joUlDH?e=61B0Ph
Regards,
Sonu
Solved! Go to Solution.
Hi @sonuojha1 ,
I updated your sample pbix file(see attachment), please check whether that is what you want.
1. Delete the relationship base on employee number among Dim - Employee, Fact - Approved Course and Fact - Course Completed table
2. Change the data type of employee number and course id with same data type among four tables
3. Create a measure to judge whether the current course is approved or completed one
Flag =
VAR _tab =
CALCULATETABLE (
VALUES ( 'Fact - Approved Course'[CourseID] ),
FILTER (
'Fact - Approved Course',
'Fact - Approved Course'[Employee Number]
= SELECTEDVALUE ( 'Dim - Employee'[Employee Number] )
)
)
VAR _tab2 =
CALCULATETABLE (
VALUES ( 'Fact - Course Completed'[CourseID] ),
FILTER (
'Fact - Course Completed',
'Fact - Course Completed'[EmpID]
= SELECTEDVALUE ( 'Dim - Employee'[Employee Number] )
)
)
RETURN
IF (
(
SELECTEDVALUE ( 'Dim - Course'[CourseID] )
IN _tab
|| SELECTEDVALUE ( 'Dim - Course'[CourseID] ) IN _tab2
),
1,
0
)
4. Create two measures as below to get the approved courses and completed%
Approved Courses =
VAR _tab =
CALCULATETABLE (
VALUES ( 'Fact - Approved Course'[CourseID] ),
FILTER (
'Fact - Approved Course',
'Fact - Approved Course'[Employee Number]
= SELECTEDVALUE ( 'Dim - Employee'[Employee Number] )
)
)
RETURN
IF (
SELECTEDVALUE ( 'Dim - Course'[CourseID] ) IN _tab,
SELECTEDVALUE ( 'Dim - Course'[CourseName] ),
BLANK ()
)
Completed% =
CALCULATE (
MAX ( 'Fact - Course Completed'[Complete %] ),
FILTER (
'Fact - Course Completed' ,
'Fact - Course Completed'[EmpID]
= SELECTEDVALUE ( 'Dim - Employee'[Employee Number] )
&& 'Fact - Course Completed'[CourseID] = SELECTEDVALUE ( 'Dim - Course'[CourseID] )
)
)
Best Regards
@sonuojha1 , what measure you need that is not clear?
Can you share expected output
Hi Amit,
Expected output is the excel image attached here. Need to show approved cases
Expected output
Hi @sonuojha1 ,
I updated your sample pbix file(see attachment), please check whether that is what you want.
1. Delete the relationship base on employee number among Dim - Employee, Fact - Approved Course and Fact - Course Completed table
2. Change the data type of employee number and course id with same data type among four tables
3. Create a measure to judge whether the current course is approved or completed one
Flag =
VAR _tab =
CALCULATETABLE (
VALUES ( 'Fact - Approved Course'[CourseID] ),
FILTER (
'Fact - Approved Course',
'Fact - Approved Course'[Employee Number]
= SELECTEDVALUE ( 'Dim - Employee'[Employee Number] )
)
)
VAR _tab2 =
CALCULATETABLE (
VALUES ( 'Fact - Course Completed'[CourseID] ),
FILTER (
'Fact - Course Completed',
'Fact - Course Completed'[EmpID]
= SELECTEDVALUE ( 'Dim - Employee'[Employee Number] )
)
)
RETURN
IF (
(
SELECTEDVALUE ( 'Dim - Course'[CourseID] )
IN _tab
|| SELECTEDVALUE ( 'Dim - Course'[CourseID] ) IN _tab2
),
1,
0
)
4. Create two measures as below to get the approved courses and completed%
Approved Courses =
VAR _tab =
CALCULATETABLE (
VALUES ( 'Fact - Approved Course'[CourseID] ),
FILTER (
'Fact - Approved Course',
'Fact - Approved Course'[Employee Number]
= SELECTEDVALUE ( 'Dim - Employee'[Employee Number] )
)
)
RETURN
IF (
SELECTEDVALUE ( 'Dim - Course'[CourseID] ) IN _tab,
SELECTEDVALUE ( 'Dim - Course'[CourseName] ),
BLANK ()
)
Completed% =
CALCULATE (
MAX ( 'Fact - Course Completed'[Complete %] ),
FILTER (
'Fact - Course Completed' ,
'Fact - Course Completed'[EmpID]
= SELECTEDVALUE ( 'Dim - Employee'[Employee Number] )
&& 'Fact - Course Completed'[CourseID] = SELECTEDVALUE ( 'Dim - Course'[CourseID] )
)
)
Best Regards
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
71 | |
67 | |
51 | |
39 | |
26 |
User | Count |
---|---|
87 | |
54 | |
45 | |
40 | |
36 |