Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Here is my measure:
Cash Balance [GBP]:=VAR CorrectTable =
ADDCOLUMNS (
GROUPBY (
Projected_Cash_Balances,
Projected_Cash_Balances[Country],
Projected_Cash_Balances[Dates]
),
"Last Balance [GBP]", SUMX (
FILTER (
Projected_Cash_Balances,
[Index] = MAX ( [Index] )
&& LASTDATE ( Projected_Cash_Balances[Dates] )
),
[Balance [GBP]]]
)
)
RETURN
AVERAGEX ( CorrectTable, AVERAGE ( [Last Balance [GBP]]] ) )
Attached is my input table, and a pivot table. The cell highlighted in yellow is wrong... : ( (it should be 79,723)
Thanks in advance,
Sachin
Solved! Go to Solution.
ok, problem now solved
VAR CorrectTable =
ADDCOLUMNS (
GROUPBY (
Projected_Cash_Balances,
Projected_Cash_Balances[Country],
Projected_Cash_Balances[Dates]
),
"Last Balance [GBP]", AVERAGEX (
FILTER (
Projected_Cash_Balances,
[Index]
= MAXX (
FILTER (
Projected_Cash_Balances,
[Country] = EARLIER ( [Country] )
&& [Dates] = MAX ( [Dates] )
),
[Index]
)
),
[Balance [GBP]]]
)
)
RETURN
SUMX (
FILTER ( CorrectTable, [Dates] = MAX ( [Dates] ) ),
[Last Balance [GBP]]]
)
This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907
Thanks for the suggested help.
I read through both links, but am still struggling with my specific problem.
The totals are not always wrong. Just wrong on some days....
With updated DAX below (but it is still not working....) = [
Cash Balance [GBP]:=VAR CorrectTable =
ADDCOLUMNS (
GROUPBY (
Projected_Cash_Balances,
Projected_Cash_Balances[Country],
Projected_Cash_Balances[Dates]
),
"Last Balance [GBP]", AVERAGEX (
FILTER (
Projected_Cash_Balances,
[Index] = MAX ( [Index] )
&& [Country] = EARLIER([Country])
&& [Dates] = MAX([Dates])),
[Balance [GBP]]]
)
)
RETURN
SUMX ( FILTER(CorrectTable, [Dates] = MAX([Dates] )), [Last Balance [GBP]]])
ok, problem now solved
VAR CorrectTable =
ADDCOLUMNS (
GROUPBY (
Projected_Cash_Balances,
Projected_Cash_Balances[Country],
Projected_Cash_Balances[Dates]
),
"Last Balance [GBP]", AVERAGEX (
FILTER (
Projected_Cash_Balances,
[Index]
= MAXX (
FILTER (
Projected_Cash_Balances,
[Country] = EARLIER ( [Country] )
&& [Dates] = MAX ( [Dates] )
),
[Index]
)
),
[Balance [GBP]]]
)
)
RETURN
SUMX (
FILTER ( CorrectTable, [Dates] = MAX ( [Dates] ) ),
[Last Balance [GBP]]]
)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
25 | |
15 | |
12 | |
8 | |
8 |
User | Count |
---|---|
19 | |
15 | |
14 | |
13 | |
13 |