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
yios
Helper I
Helper I

Sumx a column's value only once based on business logic

Hi all,

I have a question regarding the following requirement.

First of all data is like below

 

DayDutyTaskDutyStartsDutyEndsDutyDurationHrs
1D1T19:0011:002
1D1T29:0011:002
2D1T114:0019:005
2D1T214:0019:005
2D1T314:0019:005
3D1T19:0011:002
3D1T29:0011:002

 

In a visual table there will be the column Duty and then i want to display a measure which will show sum of DutyDurationHrs for all Days that this Duty exists. 

Regarding above dataset i would like to show

Duty      DutyDurationHours

D1         9

 

I mean that for each Day that this Duty exists, i want to extract the value of DutyDurationHrs only once and finally to sum all of them (for example in Day1 -> D1 duration was 2 Hrs, in Day2 -> D1 duration was 5 Hrs, in Day3 -> D1 duration was 2 Hrs, 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@yios 

 

Try this MEASURE

 

Measure =
SUMX (
    VALUES ( TableName[Day] ),
    CALCULATE ( AVERAGE ( TableName[DutyDurationHrs] ) )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@yios 

 

Try this MEASURE

 

Measure =
SUMX (
    VALUES ( TableName[Day] ),
    CALCULATE ( AVERAGE ( TableName[DutyDurationHrs] ) )
)

Regards
Zubair

Please try my custom visuals

Thanks @Zubair_Muhammad 

 

It works!

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.