Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Need help on table or formula

Hello,

 

I'm having issue regarding formula, I'm new to this languange and currently studying it.

here's what I got stucked.

 

So I have this Table

Item#Time StampHourQuantity
A1:43:01 PM131
B1:48:01 PM131
C1:47:01 PM131
A2:39:03 PM141
B2:43:12 PM141
C3:59:13 PM151
C4:03:53 PM161
C4:12:29 PM161
C4:12:29 PM161

 

But I need to summarize the report by hourly to show on the graph.

The challenging part for me is I need to rank by hour the item # thats the earliest (or lowest timestamp), and sum the total results under all hours. If it doesnt make sense. basically these is what im looking for.

 

Rank lowest time stamp - shows the item# with the lowest time stamp for that hour.

 

HourRank Lowest Time StampResults
13A3
14A2
15C1
16C3

 

 

1 ACCEPTED SOLUTION
PattemManohar
Community Champion
Community Champion

@Anonymous  Please try this as a "New Table"

 

Test11Out = 
VAR _Time = ADDCOLUMNS(SUMMARIZE(Test11,Test11[Hour],"MinTime",MIN(Test11[Time Stamp])),"Item",LOOKUPVALUE(Test11[Item#],Test11[Hour],[Hour],Test11[Time Stamp],[MinTime]))
VAR _Totals = SUMMARIZE(Test11,Test11[Hour],"Results",SUM(Test11[Quantity]))
RETURN NATURALINNERJOIN(_Time,_Totals)

image.png

 

Added the time as well, just for reference. 





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

Proud to be a PBI Community Champion




View solution in original post

2 REPLIES 2
PattemManohar
Community Champion
Community Champion

@Anonymous  Please try this as a "New Table"

 

Test11Out = 
VAR _Time = ADDCOLUMNS(SUMMARIZE(Test11,Test11[Hour],"MinTime",MIN(Test11[Time Stamp])),"Item",LOOKUPVALUE(Test11[Item#],Test11[Hour],[Hour],Test11[Time Stamp],[MinTime]))
VAR _Totals = SUMMARIZE(Test11,Test11[Hour],"Results",SUM(Test11[Quantity]))
RETURN NATURALINNERJOIN(_Time,_Totals)

image.png

 

Added the time as well, just for reference. 





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

Proud to be a PBI Community Champion




jthomson
Solution Sage
Solution Sage

Maybe look to add an index/ranking column within each hour in your dataset and use the lowest value of said index as a filter? Ranking within a group's a fairly common problem so you should be able to search and find something that works within your setup?

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.