Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
I am having difficulty creating a DAX formula that returns the sum of the differences for each customer within a group. For example, I used the ISINSCOPE formula to perform the calculation with each customer code within the industry segment, but I would like to see the total sum of these differences, which would be 5.49 and not 1.10 in +Δ. With this, I can build an analysis of customer consumption behaviors compared to the same period last year.
here is the code I am using:
Solved! Go to Solution.
@4lanR @_AAndrade has given a great solution but not to keep the logic at the multiple places this is what I will do. Just a suggestion.
Sum Sales = SUM ( Sales[Amount] )
LY Sales = CALCULATE ( [Sum Sales], SAMEPERIODLASTYEAR ('calendar'[Date] ) )
+ve Diff =
VAR __Diff = [Sum Sales] - COALESCE ( [LY Sales], 0 )
RETURN IF ( __Diff > 0, __Diff )
+Δ =
IF(
ISINSCOPE(Sales[Site_Code]),
[+ve Diff],
SUMX(
SUMMARIZE(
Sales,
Sales[Segment],
Sales[Site_Code]
),
[+ve Diff]
)
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thank you @parry2k, I managed to solve the problem with your solution. @_AAndrade , your solution also worked, but the summation still considered the differences when there was blank consumption. Nevertheless, thank you very much for the support, everyone 😁
@4lanR @_AAndrade has given a great solution but not to keep the logic at the multiple places this is what I will do. Just a suggestion.
Sum Sales = SUM ( Sales[Amount] )
LY Sales = CALCULATE ( [Sum Sales], SAMEPERIODLASTYEAR ('calendar'[Date] ) )
+ve Diff =
VAR __Diff = [Sum Sales] - COALESCE ( [LY Sales], 0 )
RETURN IF ( __Diff > 0, __Diff )
+Δ =
IF(
ISINSCOPE(Sales[Site_Code]),
[+ve Diff],
SUMX(
SUMMARIZE(
Sales,
Sales[Segment],
Sales[Site_Code]
),
[+ve Diff]
)
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @4lanR,
I don't understand the first part of your dax code becaus both part of the IF statments seems to me equal.
But using you measure, please try this:
+Δ =
VAR
SalesPriorYear = IF(
ISINSCOPE(Sales[Site_Code]),
CALCULATE(
SUM(Sales[Amount]),
PARALLELPERIOD(
calendar[Date],
-12,
MONTH
)
),
CALCULATE(
SUM(Sales[Amount]),
PARALLELPERIOD(
calendar[Date],
-12,
MONTH
)
)
)
VAR DifMeasure =
IF(
AND(
(SUM(Sales[Amount]) - SalesPriorYear) > 0,
SalesPriorYear <> BLANK()
),
SUM(Sales[Amount]) - SalesPriorYear
)
VAR TotalTab =
ADDCOLUMNS(
SUMMARIZE(
Sales,
Sales[Segment]
),
"@Total", DifMeasure
)
RETURN
IF(
ISINSCOPE(Sales[Site_Code]),
Dif,
SUMX(TotalTab, [@Total])
)
Proud to be a Super User!
Thanks. I tried using this solution, but the expected result was the same; I still couldn't sum all the differences 😢
Could you share a pbix with same data so I can take look?
Proud to be a Super User!
Hi @4lanR,
I'm attaching a pbix file with my solution.
Proud to be a Super User!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.