Forum Discussion
Anonymous
5 years agoNot applicable
Help needed with DAX...Please help....
I have two tables in Power BI Receivor table and Inventory table. I have a slicer for date field. This field, i get from calendar table. Now, my requirement is if i select a date in slicer ...
Anonymous
5 years agoNot applicable
Calendar must be a date table in the model that's been marked as such in order for the formula to work.
// Your model should be a star-schema with
// conformed dimensions. If it's not, then
// the DAX will always have problems of some
// sort. Please create correct models to
// avoid mistakes. Google for "star schema
// in Power BI" to learn about what a good
// model is.
// Assuming that Calendar is connected to
// both tables on the corresponding date fields
// and the relationships are one-to-many with
// one-way filtering.
[Total Left] =
var vLastVisibleDate = MAX( 'Calendar'[Date] )
var vLastVisibleQty =
CALCULATE(
SUM( 'Inventory Table'[Quantity] )
- SUM( 'Receivor Table'[Quantity] ),
Calendar[Date] <= vLastVisibleDate
)
RETURN
vLastVisibleQty