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

Adding records in new table based on distinct row with computation

Good day everyone, I'm new with Power BI just wanted to ask how can I add the distinct items from one table into another.

 

I wanted to save all the distinct group_items in [Items] Table to [Duration] Table and compute the total created time for each group_items. See sample image below. I've been searching all day now still no chance.

 

Untitled-1.jpg

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Adding records in new table based on distinct row with computation

Hi @nujkram

First in query editor

add two custom columns (Add Column->Custom Column)

Custom=DateTime.Time([created])

Custom.1= #time(Time.Hour([Custom]),0,0)

6.png

7.png

 

Second in Data View, create two calculated columns

duration = [Custom]-[Custom.1]

sumduration = CALCULATE(SUM(Sheet5[duration]),ALLEXCEPT(Sheet5,Sheet5[items]))

8.png

 

Second create a new table and create a calculated column in this new table

Table = SUMMARIZE(Sheet5,Sheet5[items],Sheet5[sumduration])

id = RANKX(ALL('Table'),'Table'[items],,ASC)

9.png

 

 

Best regards

maggie

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Adding records in new table based on distinct row with computation

Hi @nujkram

First in query editor

add two custom columns (Add Column->Custom Column)

Custom=DateTime.Time([created])

Custom.1= #time(Time.Hour([Custom]),0,0)

6.png

7.png

 

Second in Data View, create two calculated columns

duration = [Custom]-[Custom.1]

sumduration = CALCULATE(SUM(Sheet5[duration]),ALLEXCEPT(Sheet5,Sheet5[items]))

8.png

 

Second create a new table and create a calculated column in this new table

Table = SUMMARIZE(Sheet5,Sheet5[items],Sheet5[sumduration])

id = RANKX(ALL('Table'),'Table'[items],,ASC)

9.png

 

 

Best regards

maggie

View solution in original post

Highlighted
Regular Visitor

Re: Adding records in new table based on distinct row with computation

Thank you so much @v-juanli-msft (maggie). Works like a charm!

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.

Community Summit North America

Community Summit North America

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

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors