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
my_microsoftacc
Frequent Visitor

Calculation issues - weird grouping based on the numerical values

Hi everyone, 

I have a database of different companies' capacity per year.

The measures I created are:

  • YTD Capacity: calculates the accumulated capacity up until the year before the filtered year. 
YTD Capacity = CALCULATE(sum('Table'[Capacity]),filter(all('Table'[Year]),'Table'[Year]<Max('Table'[Year])))
  • Total capacity: calculates the total capacity of all years.
Total Capacity = calculate(sum('Table'[Capacity]),all('Table'[Year]))
 
However, for some reason, PowerBI calculates the sum based on the distinct values of the capacity. As seen in pic below, e.g: year 2015 with capacity of 120 is one group, year 2016 - 2019 with the same capacity of 150 is one group, capacity of 153 is one group etc..
The data shown belongs to one company.
Does anyone know what might be the reason for it and how to fix it? Thanks
 

Capture.PNG

3 REPLIES 3
Anonymous
Not applicable

Hi @my_microsoftacc ,

I create a table as you mentioned.

vyilongmsft_0-1718346827423.png

I think you can change your DAX codes, here is my DAX code.

YTD Capacity1 = 
CALCULATE(
    SUMX(
        FILTER(
            ALL('Table'),
            'Table'[Year] < MAX('Table'[Year])
        ),
        'Table'[Capacity]
    )
)
Total Capacity1 = 
SUMX(
    ALL('Table'),
    'Table'[Capacity]
)

vyilongmsft_1-1718346973764.png

 

 

 

Best Regards

Yilong Zhou

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

Hi thanks for your response but unfortunately it does not work. Now it sums all capacity of all products and all companies I have in my database (I have more than one product, one company)

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

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.