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 August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Text and hour into a single column

Nadzmi_1-1697094389258.png


hello, i am trying to create a table with a column as above where the rollover will be the first row above the hour. i have tried using IF functions but the result is not the same. the image is showing the hour of the date and i am assuming the rollover are those orders before the current date.

i can definitely create different tables to show the difference, but the desired outcome from the end user is as above snippet. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1697426595494.png

 

Here are the steps you can follow:

1. Create calculated column.

Hour =
FORMAT(
    'Table'[Date],"hh")
Text =
[Hour] &":"&"00"

vyangliumsft_1-1697426595497.png

2. Create calculated table.

Table 2 =
var _table1=
{"Rollover"}
var _table2=
UNION(_table1,DISTINCT('Table'[Text]))
return
ADDCOLUMNS(
   _table2,"Rcvd QTY",
    IF(
       [Value]="Rollover",SUMX(ALL('Table'),[Value]),
    SUMX(FILTER(ALL('Table'),'Table'[Text]=EARLIER([Value])),[Value])))

3. Result:

vyangliumsft_2-1697426646050.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1697426595494.png

 

Here are the steps you can follow:

1. Create calculated column.

Hour =
FORMAT(
    'Table'[Date],"hh")
Text =
[Hour] &":"&"00"

vyangliumsft_1-1697426595497.png

2. Create calculated table.

Table 2 =
var _table1=
{"Rollover"}
var _table2=
UNION(_table1,DISTINCT('Table'[Text]))
return
ADDCOLUMNS(
   _table2,"Rcvd QTY",
    IF(
       [Value]="Rollover",SUMX(ALL('Table'),[Value]),
    SUMX(FILTER(ALL('Table'),'Table'[Text]=EARLIER([Value])),[Value])))

3. Result:

vyangliumsft_2-1697426646050.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

123abc
Community Champion
Community Champion

You can use the following DAX formula as an example:

 

RolloverColumn =
VAR CurrentHour = HOUR(YourTable[YourDateColumn])
RETURN
CALCULATE(
MIN(YourTable[YourDateColumn]),
FILTER(YourTable, HOUR(YourTable[YourDateColumn]) < CurrentHour)
)

 

Replace "YourTable" with the name of your table and "YourDateColumn" with the name of the column that contains the dates or timestamps. This formula calculates the minimum date/time value that occurs before the current hour in your table.

  1. Add the new calculated column to your table visualization in the report view.

  2. Format the table as needed to achieve the desired appearance. You can modify the column headers, formatting, and other visual aspects to make it look like the snippet you provided.

This approach will create a table in Power BI where the "RolloverColumn" contains the first row above the hour, just as you described in your snippet. Adjust the column names and formatting as necessary to match your specific requirements.

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

hello Sir, 

i have tried the solution you provided but it returns a different outcome to what i am looking for, nonetheless good Sir, thank you for your time on this query. 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.