Forum Discussion
ShubhamMudliar
2 years agoNew Member
DAX for computing two measures based on selected date
Hi all, I have a scenario which I am working on . Below is an export from POwer BI report. I two table : Effective date and transactions table. Invoice amount , collected amount and open bala...
ValtteriN
2 years agoCommunity Champion
Hi,
Here is one way to do this:
Demo Data:
Data model:
Dax:
Balance =
var _t = SUM(Invoices[Total Amount])
var _due = MAX(Invoices[Due Date])
var _invoice = MAX(Invoices[Invoice Date])
var _seldate = MAX('Calendar'[Date])
var _id = MAX(Invoices[ID])
RETURN
_t -
IF(_seldate<=_due && _seldate >=_invoice,_t,
CALCULATE(SUM('Transaction'[Value]),ALL('Transaction'),'Transaction'[Date]<=_seldate,_id='Transaction'[ID])) //collected amount
Here the last 2 rows are collected amount.
End result:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
End result:
Here the conditions are fulfilled and when the selection changes the balance changes along.
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
ShubhamMudliar
2 years agoNew Member
Thanks for the solution. It worked!!