Forum Discussion
Beginning balance
- Anonymous7 years ago
I've taken a look and created a power bi file with your model and relationships. I've used variables in the measures to identify which amounts have been worked in a selected period and which have been paid based on the WDate and the WIPDate. The Unpaid Amount decreases to zero once you reach the end of the date range as one the final WIP Date, all amounts worked are paid.
Here are the formulas:
Amount Worked at start of Period =VAR MinSelectedWorkingDate = MIN('Calendar'[Date])RETURN (CALCULATE(SUM(Data[Value]), FILTER(ALL(Data), Data[WDate] < MinSelectedWorkingDate)))Amount Worked in Period = CALCULATE(SUM(Data[Value])) // This uses the default relationship from WDate to Calendar to ensure amount is in the selected periodAmount Worked at end of period = [Amount Worked at start of Period] + [Amount Worked in Period]Here are the Billed amounts:Amount Billed at start of Period =VAR MinSelectedWorkingDate = MIN('Calendar'[Date])RETURN (CALCULATE(SUM(Data[Value]), FILTER(ALL(Data), Data[WIPDate] < MinSelectedWorkingDate)))Amount Billed in Period = CALCULATE(SUM(Data[Value]), USERELATIONSHIP('Calendar'[Date], Data[WIPDate]))//This uses the USERELATIONSHIP function to switch to the inactive relationship from WIPDate to Calendar DateAmount Billed at end of Period = [Amount Billed at start of Period] + [Amount Billed in Period]Here are the amounts outstanding:Amount Owed at Start of period = [Amount Billed at start of Period] - [Amount Worked at start of Period]Amount Owed at End of Period = [Amount Billed at end of Period] - [Amount Worked at end of period]I hope this solves your problem. - please mark as Solved :)
I've taken a look and created a power bi file with your model and relationships. I've used variables in the measures to identify which amounts have been worked in a selected period and which have been paid based on the WDate and the WIPDate. The Unpaid Amount decreases to zero once you reach the end of the date range as one the final WIP Date, all amounts worked are paid.
Here are the formulas:
I hope this solves your problem. - please mark as Solved :)
Anonymousthanks! Sublimely clever. I understand each, but I am facing a new problem that I think is created by ALL. To be fair, I did not include a dimension that is important. Each of those time entry lines is assigned to a client. I need to come up with the beginning and ending balances by client. However, if I am thinking correctly, the ALL command removes the relationship between the client dimension and the filter. Therefore I get a pivot table with the same value for every client ID. Except in the two cases of "In Period". Can you see a way around this new issue?