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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
jesuslogmein
Helper I
Helper I

Subtotals per date

HI!!

 

I need to add the data that appear at interval level in a section, for example at 14.00h, and in the rest of the sections that are empty.

An example would be:

 

DATE INTERVAL ORDERS

20/11/2022 11:00 2
20/11/2022 12:00 3
20/11/2022 13:00 2
20/11/2022 14:00 2
21/11/2022 11:00 3
21/11/2022 12:00 3
21/11/2022 13:00 3
21/11/2022 14:00 4

 

The result would be as follows:

DATE INTERVAL ORDERS

20/11/2022 11:00 
20/11/2022 12:00 
20/11/2022 13:00 
20/11/2022 14:00 9
21/11/2022 11:00 
21/11/2022 12:00 
21/11/2022 13:00 
21/11/2022 14:00 13

 

 

Can we do it with dax? How would we do it?

 

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @jesuslogmein 

 

You can try the following methods.
Column:

Column = 
Var _sum=CALCULATE(SUM('Table'[ORDERS]),ALLEXCEPT('Table','Table'[DATE]))
Var _max=CALCULATE(MAX('Table'[INTERVAL]),ALLEXCEPT('Table','Table'[DATE]))
Return
IF([INTERVAL]=_max,_sum,BLANK())

vzhangti_0-1669086825626.png

Measure = 
Var _sum=CALCULATE(SUM('Table'[ORDERS]),ALLEXCEPT('Table','Table'[DATE]))
Var _max=CALCULATE(MAX('Table'[INTERVAL]),ALLEXCEPT('Table','Table'[DATE]))
Return
IF(SELECTEDVALUE('Table'[INTERVAL])=_max,_sum,BLANK())

vzhangti_1-1669086934048.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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
v-zhangti
Community Support
Community Support

Hi, @jesuslogmein 

 

You can try the following methods.
Column:

Column = 
Var _sum=CALCULATE(SUM('Table'[ORDERS]),ALLEXCEPT('Table','Table'[DATE]))
Var _max=CALCULATE(MAX('Table'[INTERVAL]),ALLEXCEPT('Table','Table'[DATE]))
Return
IF([INTERVAL]=_max,_sum,BLANK())

vzhangti_0-1669086825626.png

Measure = 
Var _sum=CALCULATE(SUM('Table'[ORDERS]),ALLEXCEPT('Table','Table'[DATE]))
Var _max=CALCULATE(MAX('Table'[INTERVAL]),ALLEXCEPT('Table','Table'[DATE]))
Return
IF(SELECTEDVALUE('Table'[INTERVAL])=_max,_sum,BLANK())

vzhangti_1-1669086934048.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

FreemanZ
Community Champion
Community Champion

@jesuslogmein 

Something like this?

FreemanZ_0-1669085678030.png

you would need to add a new column with the code below:

OrdersAccum =
VAR CurrentDate = TableName[Date]
VAR ExpectedInterval = TIME(14,0,0)
RETURN
IF(
    TableName[Interval] = ExpectedInterval,
    SUMX(
        FILTER(
            TableName,
            TableName[Date]=CurrentDate
        ),
        TableName[Orders]
    )
)
 
Be careful with data type of the interval column, i chose Time type. 

many thanks!!!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.