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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
ExcelMonke
Super User
Super User

SUMX Help - error in syntax?

Hello,
I am having some trouble with SUMX. My intended result seems to work in Excel - but not in Power BI. What i need to do, is effectively sum all the individual pieces in the column for each day. In this case, the total sum for 10/3/2023 should be 480, but it is showing 920. See the first screenshot below.

Screenshot 1:

ExcelMonke_1-1719604596997.png

The DAX For this is as follows:

 

 

Max Slot Length =
VAR _MaxSlot =
    CALCULATE (
        MAX ( 'Table'[SlotLength] ),
        FILTER (
            'Table',
            'Table'[Include/Exclude] = "Include" 
        ),
        ALLEXCEPT (
            'Table',
            'Table'[SlotDate],
            'Table'[SlotTime]
        )
    )
VAR _SumTable =
    SUMMARIZE (
        'Table',
        'Table'[SlotDate],
        'Table'[SlotTime],
        "Max Length", _MaxSlot
    )
RETURN
    CALCULATE (
        SUMX ( _SumTable, [Max Length] ),
        ALLEXCEPT ( 'Table', 'Table'[SlotDate] )
    )

 

 

 

The intended result is this:

ExcelMonke_2-1719604841868.png

Can anyone help me with this?





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

Proud to be a Super User!





4 REPLIES 4
DataNinja777
Super User
Super User

Hi @ExcelMonke ,

 

What about sumxing your result over the SlotTime field like below? 

Max Slot Length =
VAR _MaxSlot =
    CALCULATE (
        MAX ( 'Table'[SlotLength] ),
        FILTER ( 'Table', 'Table'[Include/Exclude] = "Include" ),
        ALLEXCEPT ( 'Table', 'Table'[SlotDate], 'Table'[SlotTime] )
    )
VAR _SumTable =
    SUMMARIZE (
        'Table',
        'Table'[SlotDate],
        'Table'[SlotTime],
        "Max Length", _MaxSlot
    )
RETURN
    SUMX (
        VALUES ( 'Table'[SlotTime] ),
        CALCULATE (
            SUMX ( _SumTable, [Max Length] ),
            ALLEXCEPT ( 'Table', 'Table'[SlotDate] )
        )
    )

 Best regards,

Thank you for the suggestion! Unfortunately this overestimates it even more (See Max Slot Length2)

ExcelMonke_0-1719847982120.png

 





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

Proud to be a Super User!





Anonymous
Not applicable

Hi,@ExcelMonke. I am glad to help you.
Hello,@DataNinja777 ,thanks for your concern about this issue.

Has your problem been solved yet, if not, can you provide a .pbix file that does not contain sensitive data, this will help to solve your problem.

Could you please check if your measure calculations are due to an incorrect current calculation environment, and secondly check the code itself to see if there are any problems. Because the filter settings including the relationship filter between tables in the model will also affect the measure calculation result.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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



Hello,

Unfortunately I am unable to share the relatively complex PBIX. I am hoping there's a relatively simple solution to this SUMX issue I am facing. 





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

Proud to be a Super User!





Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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