cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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

Accepted Solutions
Highlighted
Super User III
Super User III

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

@yios 

 

Try this MEASURE

 

Measure =
SUMX (
    VALUES ( TableName[Day] ),
    CALCULATE ( AVERAGE ( TableName[DutyDurationHrs] ) )
)
Try my new Power BI game Cross the River

View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

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

@yios 

 

Try this MEASURE

 

Measure =
SUMX (
    VALUES ( TableName[Day] ),
    CALCULATE ( AVERAGE ( TableName[DutyDurationHrs] ) )
)
Try my new Power BI game Cross the River

View solution in original post

Highlighted
Frequent Visitor

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

Thanks @Zubair_Muhammad 

 

It works!

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors