Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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]]]
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
47 | |
24 | |
20 | |
15 | |
12 |
User | Count |
---|---|
55 | |
48 | |
43 | |
19 | |
18 |