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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

Filter value in a new column

Hi, 

I am trying to create a new column where I can filter and select multiple options from the 'activity' column which would give me

the result of 'duration' value in my new column. 

 

From my pic you can see there is a list of activity to select from but I only need a few in my new column and their duration as a result.   PBI Filter Value.jpg

PBI for Filter Value.jpg

  

I also want this to sum the same activity for the day from the same source (name) and date. 

 

Please can you advise, I am really unable to move forward from this and your help is much appreciated. 

 

Thank you 

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

Sorry for a late reply!

You wanna sum up all the activities which contain "break",right?If so,you could use below dax expression:

Create 2 calculated columns as below:

flag = SEARCH("Break",[Activity],1,0)
Column = SUMX(FILTER('Table','Table'[flag]>0),[Duration])

 And you will see:

v-kelly-msft_0-1613718026037.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

7 REPLIES 7
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

For example ,if you just wanna get the duration for the activity of "Login",you could create a column as below:

 

Column = 
 SWITCH('Table'[Activity],
 "Login",CALCULATE(DATEDIFF(MAX('Table'[Start ]),MAX('Table'[End]),DAY)),
 BLANK())

 

And you will see:

v-kelly-msft_0-1613377599533.png

 

You can add other criteria after "switch" function if needed, and you can also use "If "function instead.

For the sample .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Anonymous
Not applicable

Hi, thank you for getting back to me. 

I have managed create a new column by using switch where it is looking at each each "xxxx" and bringing their duration value. But I need my new column to sum up all the e.g. "break" taken by each member on the same date. Please can you advise? 

 

Time in AUX =
SWITCH('Enghouse'[Activity],
"Break", Enghouse[Duration],
"Requested Worktime (Administration)", Enghouse[Duration],
"Break (Lunch)", Enghouse[Duration],
"Requested Worktime (Meeting)", Enghouse[Duration],
"Break (Scheduled Break)", Enghouse[Duration])

 

Hi @Anonymous,

 

Sorry for a late reply!

You wanna sum up all the activities which contain "break",right?If so,you could use below dax expression:

Create 2 calculated columns as below:

flag = SEARCH("Break",[Activity],1,0)
Column = SUMX(FILTER('Table','Table'[flag]>0),[Duration])

 And you will see:

v-kelly-msft_0-1613718026037.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Anonymous
Not applicable

Hi, thank you for your reply. Unfortunately, I am getting 00:00:00 as a value. 

 

This is an example of what I need in the new the column, it is very easy to do this in excel by creating a pivot anfd filtering out which I have been doing previously but finding it quite difficult in PowerBI. 

 

As you can see it needs to sum the duration of each activity performed on the same date. 

 

Appreciate your help, thank you 

 

 

Aziza_0-1614159472442.jpeg

 

VijayP
Super User
Super User

@Anonymous 

If I understood your problem Statement Correctly, you require a new column with fewer items. 

You can use a custom column with Switch Function to have the Grouped items , Liked "Abondoned","Break" as one item and so on. Then your slicer will be based on new column with fewer items and accordingly the values will be
Let me know if this solves!




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


amitchandak
Super User
Super User

@Anonymous , Create a new column like

 

sumx(filter(table, [activity] = earlier([activity]) && [Source] = earlier([Source]) && [Day] = earlier([Day])), hour([Duration])*3600+minute([Duration])*60 + second([duration]))

 

 

Also check for Duration
https://radacad.com/calculate-duration-in-days-hours-minutes-and-seconds-dynamically-in-power-bi-using-dax
https://social.technet.microsoft.com/wiki/contents/articles/33644.powerbi-aggregating-durationtime-in-dax.aspx
https://www.pbiusergroup.com/communities/community-home/digestviewer/viewthread?GroupId=547&MessageKey=814a2cb4-3cca-4cd1-a620-c467adeaaaf6&CommunityKey=b35c8468-2fd8-4e1a-8429-322c39fe7110&tab=digestviewer
https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/m-p/793639#M389

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thank you, I am not getting it right. Please can I confirm what would be the [source] and [Day]. Also, where do I get to filter the selected options from 'activity' column?

 

Sorry, I am very new to PowerBI and pretty basic. Thanks 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.