cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KevinParijs
Frequent Visitor

Openingbalancemonth vs own calculation difference

Hello,

I'm trying to report on the Opening/Closing Balance by month, but for some reason, my very first Opening Balance (using the OpeningBalanceMonth function is not showing any data).
When I rewrite the measure it does show a number.
Can someone tell me why this is happening? 

Measure 1 (using the OpeningBalanceMonth function)

KevinParijs_0-1659013351304.png

Measure 2 (using own logic)

KevinParijs_1-1659013399953.png

Below you see the difference between the two measures.
I would expect that the measure 1 (with the use of OpeningBalanceMonth function) would return the exact same thing as measure 2 (with the use of own logic)

KevinParijs_5-1659013505280.png

 

Regards,

 

Kevin

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @KevinParijs ,

 

Approve with @KevinParijs , the Microsoft Docs is  not very clearly, although it returns a scalar value that represents the expression evaluated at the first date of the month in the current context, the real calculate logic of this function is evaluating the specified expression for the date corresponding to the end of the previous month after applying all the filters.

Here is a simple sample:

vjianbolimsft_0-1659432830447.png

 

vjianbolimsft_1-1659432830451.png

 

From the picture, you can see that the opening balance of January 2022 is blank, that is because there is no data of December 2019, the opening balance of January 2022 would be the closing balance of December 2019. And if you continue to view the data of February 2022, you can see the opening balance will be the closing balance of January 2022.

vjianbolimsft_2-1659432830453.png

 

That is why your first measure does not work.

 

For more details, please refer to:

OPENINGBALANCEMONTH Function DAX.

OPENINGBALANCEMONTH, OPENINGBALANCEQUARTER, OPENINGBALANCEYEAR – DAX Guide - SQLBI 

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @KevinParijs ,

 

Approve with @KevinParijs , the Microsoft Docs is  not very clearly, although it returns a scalar value that represents the expression evaluated at the first date of the month in the current context, the real calculate logic of this function is evaluating the specified expression for the date corresponding to the end of the previous month after applying all the filters.

Here is a simple sample:

vjianbolimsft_0-1659432830447.png

 

vjianbolimsft_1-1659432830451.png

 

From the picture, you can see that the opening balance of January 2022 is blank, that is because there is no data of December 2019, the opening balance of January 2022 would be the closing balance of December 2019. And if you continue to view the data of February 2022, you can see the opening balance will be the closing balance of January 2022.

vjianbolimsft_2-1659432830453.png

 

That is why your first measure does not work.

 

For more details, please refer to:

OPENINGBALANCEMONTH Function DAX.

OPENINGBALANCEMONTH, OPENINGBALANCEQUARTER, OPENINGBALANCEYEAR – DAX Guide - SQLBI 

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@KevinParijs , Opening balance return data on the last date of the previous month. So it will not work the same as what you have

 

Refer https://www.youtube.com/watch?v=6lzYOXI5wfo&t=37s



Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Learn Power BI P&L Statement || Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s ||
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!!! How to get Quick Help !!
Resources | Master Power BI !! Expertise Power BI !! Power BI For Tableau User !!

Thank you for your response, but the Microsoft Docs is showing the following definition:

 

"Evaluates the expression at the first date of the month in the current context"

KevinParijs_0-1659016827665.png

 

https://docs.microsoft.com/en-us/dax/openingbalancemonth-function-dax

 

This made me think that by using this function it would evaluate the 1/january/2021.

Helpful resources

Announcements
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors