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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Simple_one
Helper I
Helper I

Need help for fixing this dax of Sum (not include duplicated days)

Hello everyone,

I have a dax for calculating Standard Teaching Hours for teacher

Example : We have standard teaching hours according to each type of contract for weekdays

Simple_one_0-1691806692330.png

 

In this visual , my dax has a result

Simple_one_1-1691806692124.png

In this data :

Simple_one_0-1691816525156.png

 

But this total 53.64 is not correct because some day in the teacher Schedule is duplicated (one day with many shifts)

However , the correct result is  (standard time is not calculated the day with many shifts) :

 

Simple_one_2-1691734862070.png

I made a power BI file in this link : https://drive.google.com/file/d/1EkI4Cxe6zouBPcZZXbj0c4hRVnGJcpQy/view?usp=drive_link 

Please help me for fixing this dax  !

 

2 ACCEPTED SOLUTIONS

@Simple_one  I hope this helps you. Thank You!!

> I have created Two Measure like Below :


Distinct Time = 

SUMX(

    VALUES('List Class Schedule Teacher'[TimeStandard])

    ,'List Class Schedule Teacher'[TimeStandard]

)

 

> Total Time Standard =
VAR PRT =
CALCULATE (
SUMX ( VALUES ( 'List Class Schedule Teacher'[Date Key] ), [Distinct Time] ),
'List Class Schedule Teacher'[TeacherContractType] = "Part Time",
'List Class Schedule Teacher'[TeacherCode]
= SELECTEDVALUE ( 'List Class Schedule Teacher'[TeacherCode] )
)
VAR FLT =
CALCULATE (
SUMX ( VALUES ( 'List Class Schedule Teacher'[Date Key] ), [Distinct Time] ),
'List Class Schedule Teacher'[TeacherContractType] = "Full Time",
'List Class Schedule Teacher'[TeacherCode]
= SELECTEDVALUE ( 'List Class Schedule Teacher'[TeacherCode] )
)
RETURN
PRT + FLT

Mahesh0016_1-1692006924962.png

 

 

 

View solution in original post

6 REPLIES 6
Mahesh0016
Super User
Super User

@Simple_one please can you give your logic about standard hours?
Because I was comparing the Measure result with the data so measure value is right because behind the data is 53.63. I filter out blank data so the total is 42.84.
Thank You!!

Hi @Mahesh0016 ,

Everyday has a standard Time as :

Simple_one_0-1691929547501.png

But in the data , if we sum the column Time Standard , the result is not correct because some day the teacher has many shifts ( Time Stadard for Saturday/ week is 1.6 hours for Part Time contract  ).

Example : The Saturday (17/06/2023) has 2 shifts ( if you see the raw data)

 

Simple_one_1-1691929847117.png

So the result is sum all of Time Standard ( not include duplicated day ) : 42.64.

Please help me to fix this . Thank you

 

Mahesh0016
Super User
Super User

@Simple_one Please can you share your Expected output in the table for better understanding? Thank You!!

Hi @Mahesh0016 ,

I want the output of Standard Teaching Time in visual is : 42.64

Simple_one_0-1691822431063.png

 

My dax is not correct. Can you help me fix it ?

@Simple_one  I hope this helps you. Thank You!!

> I have created Two Measure like Below :


Distinct Time = 

SUMX(

    VALUES('List Class Schedule Teacher'[TimeStandard])

    ,'List Class Schedule Teacher'[TimeStandard]

)

 

> Total Time Standard =
VAR PRT =
CALCULATE (
SUMX ( VALUES ( 'List Class Schedule Teacher'[Date Key] ), [Distinct Time] ),
'List Class Schedule Teacher'[TeacherContractType] = "Part Time",
'List Class Schedule Teacher'[TeacherCode]
= SELECTEDVALUE ( 'List Class Schedule Teacher'[TeacherCode] )
)
VAR FLT =
CALCULATE (
SUMX ( VALUES ( 'List Class Schedule Teacher'[Date Key] ), [Distinct Time] ),
'List Class Schedule Teacher'[TeacherContractType] = "Full Time",
'List Class Schedule Teacher'[TeacherCode]
= SELECTEDVALUE ( 'List Class Schedule Teacher'[TeacherCode] )
)
RETURN
PRT + FLT

Mahesh0016_1-1692006924962.png

 

 

 

Hi @Mahesh0016,

Thank you so much !

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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