Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi, everyone,
I've been having troubles with my total POWER BI code and I would like to know if you could help me. My problem is that in the subtotals I am looking to add (using SUMX) the maximums depending on the 2 seasons multiplied by their respective days, while in the normal values I am looking to have only the maximums that were in the season. My current formula is the following:
| Season | Days | MAX |
| Summer | 28 | 453 |
| Winter | 3 | 417 |
| Total | 31 | 14,043 |
Solved! Go to Solution.
The reason you get the wrong total days is because the SUMX is iterating over all days in your table, rather than just the two seasons. You can try something like the following:
MAX = IF (HASONEVALUE (
'Table'[Season]),
MAX('Table'[MAX Daily]),
SUMX(
ADDCOLUMNS(
SUMMARIZE('Table', 'Table'[Season]),
"season max", CALCULATE(MAX('Table'[MAX Daily])),
"days", CALCULATE(COUNTROWS('Table'))
), [season max] * [days]
))
The reason you get the wrong total days is because the SUMX is iterating over all days in your table, rather than just the two seasons. You can try something like the following:
MAX = IF (HASONEVALUE (
'Table'[Season]),
MAX('Table'[MAX Daily]),
SUMX(
ADDCOLUMNS(
SUMMARIZE('Table', 'Table'[Season]),
"season max", CALCULATE(MAX('Table'[MAX Daily])),
"days", CALCULATE(COUNTROWS('Table'))
), [season max] * [days]
))
¡Thanks a lot! It was very helpfull 😃
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 64 | |
| 51 | |
| 46 | |
| 23 | |
| 19 |
| User | Count |
|---|---|
| 139 | |
| 112 | |
| 51 | |
| 33 | |
| 29 |