March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi
I hope you can help me, been driving myself nuts with this while trying a whole lot of different options, searching for new ideas, etc., etc.
But here goes, I have this measure, that works great in the purpose I had it from the start - do display the latest value per ATM name in a Table visual.
But now when I would like to use that same measure in a line chart, it just displays the latest value and has no regard to the country, but rather displays only 1 latest value in the line chart.
Below I have put a snip of the dataI have.
The measure is below:
Measure - ATM remaining balance = CALCULATE( FIRSTNONBLANK(bi_atm_customer_remaining_balance[atm_remaining_balance_without_reject],""), FILTER(bi_atm_customer_remaining_balance,MAX(bi_atm_customer_remaining_balance[les_transaction_started])) )
And what it currently looks like is here:
The total amount that should be displayed in the chart should be 14 273 000, but now it just displays one of those latest values.
The thing is that in the table the measure is correct. But in the line chart it does not summarize, which again is kinda correct, but not how I would want this too. I've tried countless of different options, but have come short.
Can you guys help to get the summary of the latest values by ATMs per day?
Solved! Go to Solution.
I don't know your model, so I had to write such a mesaure in a model that I imagine there should be. A correct model.
// Your formula is incorrect for several reasons.
// One of them is that such a measure must return
// a number, not text. Also, your model needs to
// be correct (think: star schema) to carry out
// correct and fast calculations.
ATM Balance =
var LastDateInContext = MAX( 'Dates'[Date] )
var Result =
SUMX(
DISTINCT( ATM[AtmID] ),
// For each atm you should get the latest
// amount in the current context, assuming
// that 'Dates'[Date] is the column that
// joins to your fact table (NetDailyTransactions)
// on some NetDailyTransactions[Date] field.
// I assume that the fact table
// stores the net amount found in each atm
// for any days where there were withdrawals
// or fill-ups. Let's assume that the field
// NetDailyTransactions[NetAmount] stores the
// amount in the atm in question as recorded
// at the end of such a day.
MAXX(
TOPN(1,
CALCULATETABLE(
NetDailyTransactions,
// 'Dates' must be a proper date table
// in the model. See dax.guide/dateadd
// for guidance on how to build such
// a table.
'Dates'[Date] <= LastDateInContext,
ALLEXCEPT( NetDailyTransactions, ATM )
),
NetDailyTransactions[Date],
DESC
),
NetDailyTransactions[NetAmount]
)
)
return
Result
I don't know your model, so I had to write such a mesaure in a model that I imagine there should be. A correct model.
// Your formula is incorrect for several reasons.
// One of them is that such a measure must return
// a number, not text. Also, your model needs to
// be correct (think: star schema) to carry out
// correct and fast calculations.
ATM Balance =
var LastDateInContext = MAX( 'Dates'[Date] )
var Result =
SUMX(
DISTINCT( ATM[AtmID] ),
// For each atm you should get the latest
// amount in the current context, assuming
// that 'Dates'[Date] is the column that
// joins to your fact table (NetDailyTransactions)
// on some NetDailyTransactions[Date] field.
// I assume that the fact table
// stores the net amount found in each atm
// for any days where there were withdrawals
// or fill-ups. Let's assume that the field
// NetDailyTransactions[NetAmount] stores the
// amount in the atm in question as recorded
// at the end of such a day.
MAXX(
TOPN(1,
CALCULATETABLE(
NetDailyTransactions,
// 'Dates' must be a proper date table
// in the model. See dax.guide/dateadd
// for guidance on how to build such
// a table.
'Dates'[Date] <= LastDateInContext,
ALLEXCEPT( NetDailyTransactions, ATM )
),
NetDailyTransactions[Date],
DESC
),
NetDailyTransactions[NetAmount]
)
)
return
Result
@daxer-almighty Thanks for your mightiness in DAX 🙂
I used your logic and it works. Only changed the LastDateInContext from the date table date to my fact table datetime and it worked.
Thanks a lot!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
18 | |
16 | |
13 |