Forum Discussion
Dax measure for below problem
- 9 months ago
Hi Anonymous
Closing Balance := CALCULATE( SUM(Inventory[Quantity]), FILTER( ALL(Calendar), Calendar[Date] <= MAX(Calendar[Date]) ) )This works for Daily, Monthly, Quarterly, and Yearly because the MAX(Calendar[Date]) changes based on the visual’s granularity.
--------------------------------
I hope this helps, please give kudos and mark as solved if it does!
Connect with me on LinkedIn.
Subscribe to my YouTube channel for Fabric/Power Platform related content!
- 9 months ago
Anonymous
Daily Closing Balance =
CALCULATE(
SUM('Inventory'[Quantity]),
FILTER(
ALL('Calendar'),
'Calendar'[Date] <= MAX('Calendar'[Date])
)
)Monthly Closing Balance =
CLOSINGBALANCEMONTH(SUM('Inventory'[Quantity]), 'Calendar'[Date])Quarterly Closing Balance =
CLOSINGBALANCEQUARTER(SUM('Inventory'[Quantity]), 'Calendar'[Date])Yearly Closing Balance =
CLOSINGBALANCEYEAR(SUM('Inventory'[Quantity]), 'Calendar'[Date])If this answer helped, please click Kudos or Accept as Solution.
-Kedar
LinkedIn: https://www.linkedin.com/in/kedar-pande - 9 months ago
Anonymous ,
1.
Daily Closing Balance = CALCULATE ( SUM ( 'Inventory'[Quantity] ), FILTER ( ALL ( 'Calendar'[Date] ), 'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) ) )2.
Monthly Closing Balance = VAR _LastDay = EOMONTH ( MAX ( 'Calendar'[Date] ), 0 ) RETURN CALCULATE ( [Daily Closing Balance], 'Calendar'[Date] = _LastDay )3.
Quarterly Closing Balance = VAR _LastDayQuarter = ENDOFQUARTER ( 'Calendar'[Date] ) RETURN CALCULATE ( [Daily Closing Balance], 'Calendar'[Date] = _LastDayQuarter )4.
Yearly Closing Balance = VAR _LastDayYear = ENDOFYEAR ( 'Calendar'[Date] ) RETURN CALCULATE ( [Daily Closing Balance], 'Calendar'[Date] = _LastDayYear ) - 9 months ago
hi Anonymous ,
try below:
Closing Balance KeepFilters = VAR LastDate = MAX('Calendar'[Date]) RETURN CALCULATE( SUM('Inventory Transaction'[Quantity]), KEEPFILTERS('Inventory Transaction'[Posting date] <= LastDate) )Closing Balance CalcTable = VAR LastDate = MAX('Calendar'[Date]) VAR FilteredTransactions = CALCULATETABLE( 'Inventory Transaction', 'Inventory Transaction'[Posting date] <= LastDate ) RETURN SUMX(FilteredTransactions, [Quantity])If it doesnt work, please provide more information on input/output.
Please give kudos or mark it as solution once confirmed.
Thanks and Regards,
Praful
Hi Anonymous ,
Thank you Kedar_Pande , Arul , Praful_Potphode , wardy912 for your inputs.
I just wanted to check if the issue has been resolved on your end, or if you require any further assistance. Please feel free to let us know, we’re happy to help!
Thank you
Chaithra E.