Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
I have the below measure.
| Date | Employee | Worked Job 1 | Worked Job 2 | Worked Job 3 | Worked Job 4 | Worked Job 5 |
Can this be achieved with any visualisations in Power BI?
Solved! Go to Solution.
Hi @Anonymous ,
Did you mean there's blank value in Job column like this?
If this is the case, you can modify the formula of Rank like this:
Rank =
IF (
'Table'[Job] = BLANK (),
BLANK (),
RANKX (
FILTER (
'Table',
'Table'[Date] = EARLIER ( 'Table'[Date] )
&& 'Table'[Employee Name] = EARLIER ( 'Table'[Employee Name] )
&& 'Table'[Job] <> BLANK ()
),
'Table'[Job],
,
ASC,
DENSE
)
)
Then it can get the correct rank.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
According to your description, it's hard to transform data to get the expected result in PowerQuery. Here's my solution:
1.Create a rank column.
Rank =
RANKX (
FILTER (
'Table',
'Table'[Date] = EARLIER ( 'Table'[Date] )
&& 'Table'[Employee Name] = EARLIER ( 'Table'[Employee Name] )
),
'Table'[Job],
,
ASC,
DENSE
)
Get the rank belong to the same date and same employee.
2.Create measures.
Job1 =
IF (
MAXX (
FILTER (
ALL ( 'Table' ),
'Table'[Date] = MAX ( 'Table'[Date] )
&& 'Table'[Employee Name] = MAX ( 'Table'[Employee Name] )
),
'Table'[Rank]
) >= 5,
CALCULATE ( MAX ( 'Table'[Job] ), 'Table'[Rank] = 1 )
)
Job2 =
IF (
MAXX (
FILTER (
ALL ( 'Table' ),
'Table'[Date] = MAX ( 'Table'[Date] )
&& 'Table'[Employee Name] = MAX ( 'Table'[Employee Name] )
),
'Table'[Rank]
) >= 5,
CALCULATE ( MAX ( 'Table'[Job] ), 'Table'[Rank] = 2 )
)
Job3 =
IF (
MAXX (
FILTER (
ALL ( 'Table' ),
'Table'[Date] = MAX ( 'Table'[Date] )
&& 'Table'[Employee Name] = MAX ( 'Table'[Employee Name] )
),
'Table'[Rank]
) >= 5,
CALCULATE ( MAX ( 'Table'[Job] ), 'Table'[Rank] = 3 )
)
Job4 =
IF (
MAXX (
FILTER (
ALL ( 'Table' ),
'Table'[Date] = MAX ( 'Table'[Date] )
&& 'Table'[Employee Name] = MAX ( 'Table'[Employee Name] )
),
'Table'[Rank]
) >= 5,
CALCULATE ( MAX ( 'Table'[Job] ), 'Table'[Rank] = 4 )
)
Job5 =
IF (
MAXX (
FILTER (
ALL ( 'Table' ),
'Table'[Date] = MAX ( 'Table'[Date] )
&& 'Table'[Employee Name] = MAX ( 'Table'[Employee Name] )
),
'Table'[Rank]
) >= 5,
CALCULATE ( MAX ( 'Table'[Job] ), 'Table'[Rank] = 5 )
)
Get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you very much for taking the time to look at my post.
This works great however where my data sometimes shows column 'Job' as null (blank), the formular counts this null row as a job. Is there anyway to exclude blanks from this?
Many thanks
Hi @Anonymous ,
Did you mean there's blank value in Job column like this?
If this is the case, you can modify the formula of Rank like this:
Rank =
IF (
'Table'[Job] = BLANK (),
BLANK (),
RANKX (
FILTER (
'Table',
'Table'[Date] = EARLIER ( 'Table'[Date] )
&& 'Table'[Employee Name] = EARLIER ( 'Table'[Employee Name] )
&& 'Table'[Job] <> BLANK ()
),
'Table'[Job],
,
ASC,
DENSE
)
)
Then it can get the correct rank.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Please see the attached excel document showing a sample piece of demo data and the desired output.
Many thanks
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 63 | |
| 62 | |
| 42 | |
| 19 | |
| 16 |
| User | Count |
|---|---|
| 113 | |
| 105 | |
| 36 | |
| 28 | |
| 28 |