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
sakuragihana
Helper IV
Helper IV

Help me to fix my dax for calculating Total of hour

Hello everyone, I have a power BI file with dax :

 

Standard Teaching Time =
VAR fulltypecode = SELECTEDVALUE('Contract'[FulltimeTypeCode])
VAR Dayteach = SELECTEDVALUE('Teacher Schedule'[DateNameSched])
VAR filer_standard = FILTER('StandardTime',
                            'StandardTime'[FulltimeTypeCode] = fulltypecode
                            && Dayteach = 'StandardTime'[WeekDay])
VAR distribution = SUMMARIZE(filer_standard,'StandardTime'[Time Standard])
VAR Countdayofweek = 'Teacher Schedule'[DayOfWeekCount]
VAR Result = Countdayofweek * distribution
Return Result
 
The visual is :
sakuragihana_0-1688119089232.png

The dax can not calculate the total of Standard Teaching Time

I make a power BI file with table data in this link:https://drive.google.com/file/d/1kc-GrVz2PvPxhUEBCq9yandeIvCUR_x4/view?usp=drive_link 

Can everyone help me to fix this dax for calculating total ?

2 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @sakuragihana 
Please refer to attched amended file with the solution

1.png

Standard Teaching Time = 
SUMX (
    CROSSJOIN (
        VALUES ( 'Contract'[FulltimeTypeCode] ),
        SUMMARIZE ( 'Teacher Schedule', 'Teacher Schedule'[Teacher Code], 'Teacher Schedule'[DateNameSched] )
    ),
    VAR filer_standard =
        FILTER ( CALCULATETABLE ( 'StandardTime' ), 'StandardTime'[WeekDay] = 'Teacher Schedule'[DateNameSched] )
    VAR distribution =
        SUMX ( filer_standard, 'StandardTime'[Time Standard] )
    VAR Countdayofweek = [DayOfWeekCount]
    VAR Result = Countdayofweek * distribution
    RETURN
        Result
)

View solution in original post

7 REPLIES 7
tamerj1
Super User
Super User

Hi @sakuragihana 
Please refer to attched amended file with the solution

1.png

Standard Teaching Time = 
SUMX (
    CROSSJOIN (
        VALUES ( 'Contract'[FulltimeTypeCode] ),
        SUMMARIZE ( 'Teacher Schedule', 'Teacher Schedule'[Teacher Code], 'Teacher Schedule'[DateNameSched] )
    ),
    VAR filer_standard =
        FILTER ( CALCULATETABLE ( 'StandardTime' ), 'StandardTime'[WeekDay] = 'Teacher Schedule'[DateNameSched] )
    VAR distribution =
        SUMX ( filer_standard, 'StandardTime'[Time Standard] )
    VAR Countdayofweek = [DayOfWeekCount]
    VAR Result = Countdayofweek * distribution
    RETURN
        Result
)

Hi @tamerj1 ,

Thank you so much!

Hi @tamerj1 ,

If I want to calculate Standard Teaching Time for all of month .

Example : January 2023 have 31 days

Mon : 5 days

Tue : 5 days

Wed: 4 days

Thu : 4 days

Fri : 4 days

Sat: 4 days

Sun: 5 days

 

Can you help me to calculate standard teaching time for whole of months follow distribution of day ?

@sakuragihana 
I did some modifications on the data model and the Standard Teaching Time measure. Please refer to attached for more details.

1.png

Hi @tamerj1 ,

 I want to calculate Standard Teaching Time follow of DaysofWeekFullMonth by distribution . In this file the Standard Teaching Time was calculated by DayofWeekCount

Can you help me ?

Hi @tamerj1 ,

Thank you a lot !

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.