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
sraj
Responsive Resident
Responsive Resident

Measure or a Column question

Hi,

 

Not sure if I need a measure or a calculated column.  Looking for only those users who have PASSED in all the trainings they were enrolled in, which varies from 4, 5 or 6 any number.  So in the below example only A & C are the eligible users, how can I get this?  I hope this makes sense, can someone please advise on how I can achieve this?

 

sraj_0-1646928046758.png

Thank you!!

2 ACCEPTED SOLUTIONS

Here is the calculation in DAX for the calculated column. It returns 1 if the user passed all the trainings. Let me know if it works.

Flag =
VAR WhichUser = 'Table'[User]
VAR NoOfPasses =
CALCULATE (
COUNT ( 'Table'[PASS/FAIL] ),
ALL ( 'Table' ),
'Table'[User] = WhichUser,
'Table'[PASS/FAIL] = "PASS"
)


VAR NoOfTrainings =
CALCULATE (
COUNT ( 'Table'[Training Name] ),
ALL ( 'Table' ),
'Table'[User] = WhichUser
 )

RETURN
IF ( NoOfPasses = NoOfTrainings, 1, 0 )


 

View solution in original post

This includes a clause where it will ignore any fails older than 1 year

Flag = 

VAR WhichUser = 'Table'[User]
VAR CutOffDate = EDATE(TODAY(), -12)

VAR NoOfPasses =
CALCULATE(
COUNT('Table'[PASS/FAIL]),
ALL('Table'),
'Table'[User] = WhichUser,
'Table'[PASS/FAIL] = "PASS",
'Table'[Merge] >= CutOffDate
)

VAR NoOfTrainings =
CALCULATE(
COUNT('Table'[Training Name]),
ALL('Table'),
'Table'[User] = WhichUser,
'Table'[Merge] >= CutOffDate
)

RETURN

IF( NoOfPasses = NoOfTrainings, 1, 0)

 

View solution in original post

13 REPLIES 13
Tutu_in_YYC
Resident Rockstar
Resident Rockstar

The easiest way is to create a calculated column that flags the users that have passed all the tests.
Then depending on how you want to visualize, you can create a measure using the flag.

sraj
Responsive Resident
Responsive Resident

Do you mind showing how I can get the calculated column for this?  Just showing on a table view

Here is the calculation in DAX for the calculated column. It returns 1 if the user passed all the trainings. Let me know if it works.

Flag =
VAR WhichUser = 'Table'[User]
VAR NoOfPasses =
CALCULATE (
COUNT ( 'Table'[PASS/FAIL] ),
ALL ( 'Table' ),
'Table'[User] = WhichUser,
'Table'[PASS/FAIL] = "PASS"
)


VAR NoOfTrainings =
CALCULATE (
COUNT ( 'Table'[Training Name] ),
ALL ( 'Table' ),
'Table'[User] = WhichUser
 )

RETURN
IF ( NoOfPasses = NoOfTrainings, 1, 0 )


 

sraj
Responsive Resident
Responsive Resident

@Tutu_in_YYC - can I add this clause in too?  Users falling in this category and have passed between these dates can be 1 too... those examples I shared had failed before 3/11/2021 date of failure was 12/15/2020

 

sraj_0-1646935433172.png

 

sraj
Responsive Resident
Responsive Resident

USERDeptTraining NamePASS/FAILMerge
     
AHRWEBPASS3/1/2022
AHRSOCIALPASS11/17/2020
AHRPERSONALPASS12/1/2020
AHRPROACTIVEPASS12/8/2020
BITWEBFAIL12/15/2020
BITSOCIALFAIL11/17/2020
BITPERSONALPASS11/9/2021
BITPROACTIVEPASS3/1/2022
BITPASSPHRASEPASS12/15/2020
BITINSIDERPASS12/22/2020
CRESPPROACTIVEPASS9/7/2021
CRESPPASSPHRASEPASS10/5/2021
CRESPINSIDERPASS11/2/2021
DOTWEBFAIL5/24/2021
DOTSOCIALPASS12/22/2020
DOTPERSONALPASS2/2/2021
DOTPROACTIVEPASS3/2/2021

This includes a clause where it will ignore any fails older than 1 year

Flag = 

VAR WhichUser = 'Table'[User]
VAR CutOffDate = EDATE(TODAY(), -12)

VAR NoOfPasses =
CALCULATE(
COUNT('Table'[PASS/FAIL]),
ALL('Table'),
'Table'[User] = WhichUser,
'Table'[PASS/FAIL] = "PASS",
'Table'[Merge] >= CutOffDate
)

VAR NoOfTrainings =
CALCULATE(
COUNT('Table'[Training Name]),
ALL('Table'),
'Table'[User] = WhichUser,
'Table'[Merge] >= CutOffDate
)

RETURN

IF( NoOfPasses = NoOfTrainings, 1, 0)

 

sraj
Responsive Resident
Responsive Resident

@Tutu_in_YYC - 

Hi there - I thought I was all done with this one but now I am asked to add another clause, which I dont know if it's possible...I may have to give up on this report.  

Come to know on top all passes in the last 365 days they want to make sure the user has passed in these two specific quiz (Mega quiz 1 & mega Quiz 2) on the first 7 days of enrollment that's the merged DATE.  This is the latest of what we have

 

Flag =
VAR WhichUser = 'User Performance'[Name]
VAR CutOffDate = EDATE(TODAY(), -12)
VAR NoOfPasses =
CALCULATE (
COUNT ( 'User Performance'[PASS/FAIL] ),
ALL ( 'User Performance' ),
'User Performance'[Name] = WhichUser,
'User Performance'[PASS/FAIL] = "Passed" ,
'User Performance'[Merged] >= CutOffDate
)

VAR NoOfTrainings =
CALCULATE (
COUNT ( 'User Performance'[Training Name] ),
ALL ( 'User Performance' ),
'User Performance'[Name] = WhichUser,
'User Performance'[Merged] >= CutOffDate

)

RETURN
IF ( NoOfPasses = NoOfTrainings10 )

 

Hi
what do you mean by  "on the first 7 days of enrollment" ? Is merge the registration date or passing/fail date?

sraj
Responsive Resident
Responsive Resident

Merge date is the enrollment date of the user and  "on the first 7 days of enrollment"  means 7 days from the enrollment date.

Then we are missing a column for [Pass Date] (based on the data provided in previous post). Since we need to compare passing date with enrolment date. Do we have that column?

sraj
Responsive Resident
Responsive Resident

That worked, I had other exceptions on there due to which I didnt see it all....but it works beautifully!! Thank you!!

amitchandak
Super User
Super User

@sraj , Create a measure like

 

countx(Filter(Summarize(Table, Table[USer], "_count", distinctCOUNT(Table[training Name]) , "_countpass", calculate(distinctCOUNT(Table[training Name]), filter(Table, Table[Pass/Fail] ="PASS"))), [_count] = [_countpass] ),[USer])

 

 

and plot this with user

sraj
Responsive Resident
Responsive Resident

Its a table visual, will this work then?

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.