March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
Here is my dataset:
Account | PERIOD YEAR | PERIOD NAME | Beginning Balance | Closing Balance |
10040 | 2019 | Apr-19 | 960019 | 775211 |
10040 | 2019 | Aug-19 | 219255 | 219255 |
10040 | 2019 | Jul-19 | 214425 | 219255 |
10040 | 2019 | Jun-19 | 785203 | 214425 |
10040 | 2019 | May-19 | 775211 | 785203 |
10040 | 2019 | Oct-19 | 219255 | 219255 |
10040 | 2019 | Sep-19 | 219255 | 219255 |
I have opening and closing balances for different Gl accounts for a given fiscal year, for different periods.
My users want to filter on a set of periods (in the same FY), eg from Apr-19 to May-19 and show the opening and closing balances for each account of the selected range of periods.
It should look like this:
Account | PERIOD YEAR | PERIOD NAME | Beginning Balance | Closing Balance | Beginning Balance of Selected Periods | Closing Balance of Selected Periods |
10040 | 2019 | Apr-19 | 960019 | 775211 | 960019 | 214425 |
10040 | 2019 | May-19 | 775211 | 785203 | 960019 | 214425 |
10040 | 2019 | Jun-19 | 785203 | 214425 | 960019 | 214425 |
How can I obtain these measures Beginning Balance of Selected Periods and Closing Balance of Selected Periods?
Thanks.
Solved! Go to Solution.
@hgrangeret try these two measures
Start Balance = VAR minDate = CALCULATE( MIN( Table2[PERIOD NAME] ), ALLSELECTED( Table2[PERIOD NAME] ) ) RETURN CALCULATE( FIRSTNONBLANK( Table2[Beginning Balance], 1), FILTER( ALLEXCEPT( Table2, Table2[Account] ), Table2[PERIOD NAME] = minDate ) )
End Balance = VAR maxDate = CALCULATE( MAX( Table2[PERIOD NAME] ), ALLSELECTED( Table2[PERIOD NAME] ) ) RETURN CALCULATE( LASTNONBLANK( Table2[Closing Balance], 1), FILTER( ALLEXCEPT( Table2, Table2[Account] ), Table2[PERIOD NAME] = maxDate ) )
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@hgrangeret try these two measures
Start Balance = VAR minDate = CALCULATE( MIN( Table2[PERIOD NAME] ), ALLSELECTED( Table2[PERIOD NAME] ) ) RETURN CALCULATE( FIRSTNONBLANK( Table2[Beginning Balance], 1), FILTER( ALLEXCEPT( Table2, Table2[Account] ), Table2[PERIOD NAME] = minDate ) )
End Balance = VAR maxDate = CALCULATE( MAX( Table2[PERIOD NAME] ), ALLSELECTED( Table2[PERIOD NAME] ) ) RETURN CALCULATE( LASTNONBLANK( Table2[Closing Balance], 1), FILTER( ALLEXCEPT( Table2, Table2[Account] ), Table2[PERIOD NAME] = maxDate ) )
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thanks parry2k,
It did work as expected.
User | Count |
---|---|
120 | |
78 | |
58 | |
52 | |
46 |
User | Count |
---|---|
170 | |
117 | |
63 | |
58 | |
51 |