The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi everyone,
I would like to calculate the user balance for a specific month.
Sample data:
When I applied filter [Year] = 2022 and [Month] = December, it should take the balance with GREEN highlight.
Expected outcome:
Does anyone have any ideas what kind of formula I should apply?
Any help would be much appreciated.
Thanks in advance!
Kindly Regards,
Milan
Solved! Go to Solution.
Hi @Milan14
Please refer to attaches sample file with the solution
Balance Measure =
VAR SelectedDate = MAX ( 'Date'[Date] )
VAR Result =
SUMX (
VALUES ( 'Table'[UserID] ),
VAR CurrentIDTable = CALCULATETABLE ( 'Table' )
VAR MaxDateRecord = TOPN ( 1, FILTER ( CurrentIDTable, 'Table'[Date] <= SelectedDate ), 'Table'[Date] )
RETURN
MAXX ( MaxDateRecord, 'Table'[Balance] )
)
RETURN
Result
Hi @Milan14
Please refer to attaches sample file with the solution
Balance Measure =
VAR SelectedDate = MAX ( 'Date'[Date] )
VAR Result =
SUMX (
VALUES ( 'Table'[UserID] ),
VAR CurrentIDTable = CALCULATETABLE ( 'Table' )
VAR MaxDateRecord = TOPN ( 1, FILTER ( CurrentIDTable, 'Table'[Date] <= SelectedDate ), 'Table'[Date] )
RETURN
MAXX ( MaxDateRecord, 'Table'[Balance] )
)
RETURN
Result