Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Filter

Ik heb een tabel met:

datum, naam medewerker, roosteruren, waarvan uren verlof, uren ziek, uren gewerkt. 
nu wil ik een DAX functie maken om het percentage te berekenen van aantal medewerkers die in de geselecteerde periode niet ziek zijn geweest (som van de kolom waarde ziek is 0) ten opzichte van alle medewerkers. 

wie kan mij hier bij helpen? 

 

1 ACCEPTED SOLUTION

@Anonymous 
Appologies for the late reply. Here is a sample file with the solution https://we.tl/t-9aEQxioBnY

Hope this is what you're looking for

1.png

Haven't Been Ill At All Count = 
VAR TotalCount = DISTINCTCOUNT ( Data[Name] )
VAR IllCount = CALCULATE ( DISTINCTCOUNT ( Data[Name] ), Data[hours of illness] > 0 )
VAR NotIllCount = TotalCount - IllCount
VAR NotIllPercent = FORMAT ( DIVIDE ( NotIllCount, TotalCount ), "Percent" )
RETURN
    IF (
        Not ISBLANK ( TotalCount ),
        NotIllCount & " (" & NotIllPercent & ")"
    )

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

This is the data.

 

DateNameScheduled working timeleave hourshours of illnessworking hours
15-5-2022employee 18008
16-6-2022employee 18008
17-5-2022employee 28800
18-5-2022employee 38080
19-6-2022employee 38008
20-6-2022employee 48008
21-6-2022employee 58008
22-6-2022employee 28080
23-6-2022employee 58008
24-6-2022employee 68008
25-5-2022employee 58080
26-6-2022employee 68008
27-6-2022employee 68008
28-5-2022employee 48008
29-5-2022employee 68008

 

The outcome should be:

nr. employee not haven been ill at all in june: 5 (83,3% of total employee's)

nr. employee not haven been ill at all in may: 4 (66,7% of total employee's)

nr. employee not haven been ill at all: 3 (50,0% of total employee's)

name            june   may    total

employee 1000
employee 2808
employee 3088
employee 4000
employee 5088
employee 6000

 

@Anonymous 
Appologies for the late reply. Here is a sample file with the solution https://we.tl/t-9aEQxioBnY

Hope this is what you're looking for

1.png

Haven't Been Ill At All Count = 
VAR TotalCount = DISTINCTCOUNT ( Data[Name] )
VAR IllCount = CALCULATE ( DISTINCTCOUNT ( Data[Name] ), Data[hours of illness] > 0 )
VAR NotIllCount = TotalCount - IllCount
VAR NotIllPercent = FORMAT ( DIVIDE ( NotIllCount, TotalCount ), "Percent" )
RETURN
    IF (
        Not ISBLANK ( TotalCount ),
        NotIllCount & " (" & NotIllPercent & ")"
    )
Anonymous
Not applicable

thank you very much for this solution. It works perfectly. 

This will help me also with writing other functions. 

tamerj1
Super User
Super User

Hi @Anonymous 
Please share sample file. 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.