Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
edge9999
Frequent Visitor

P & L Statement in Power BI

I am trying to create a simple P & L Statement with Current month Actuals and prior month actuals.  I have a detailed set of transactional data that has rows similiar to this

 

Transaction Date

Fiscal Period  (eg 202202)

Account

Amount

Location 

Company

 

edge9999_1-1649541700694.png

 

 

The data table is for multple years.   I have a Fiscal Period table that is not joined to the transactional table that looks something like this.

 

Fiscal Period

Month

Year

Prior Fiscal Period 1

Prior Fiscal period 2

Prior Fiscal Period 3 etc

Future Fiscal period 1

edge9999_0-1649541647556.png

 

My plan was to have the user select a Month and fiscal year which would retrieve one record in the Fiscal period table.   From this record, i could then figure out what the current period is as well as the prior or future periods.    The formula i have used for my current month actuals is as follows

 

MS_CURRMTDAMT = CALCULATE(
sum(VW_NS_TRANSACTION[AMOUNT_DRCR]),
TREATAS(Values(VW_CALENDAR_FISCALPERIOD[POSTINGPERIOD]),VW_NS_TRANSACTION[POSTING_PERIOD])
 
This formula seems to work and when i change my slicer the period values update.    I tried the same logic for my prior period with the formula being 
MS_PRIOR_1_MTD = CALCULATE(
sum(VW_NS_TRANSACTION_[AMOUNT_DRCR]),
TREATAS(Values(VW_CALENDAR_FISCALPERIOD[POSTINGPERIOD_PRIOR_1] ),VW_NS_TRANSACTION[POSTING_PERIOD])
)
 
This formula will not return any values.    What am i missing here?   It feels like i'm applying the same logic in both formulas, just using a differnet field from the fiscal period table.   Any thoughts here?

Thanks
1 ACCEPTED SOLUTION
edge9999
Frequent Visitor

As it turns out, i had a data issue.  When the Fiscal period data got loaded, there was a space in front of the prior period which was why it was returning blank.   

View solution in original post

2 REPLIES 2
edge9999
Frequent Visitor

As it turns out, i had a data issue.  When the Fiscal period data got loaded, there was a space in front of the prior period which was why it was returning blank.   

v-kkf-msft
Community Support
Community Support

Hi @edge9999 ,

 

Because of the TREATAS function, for measure [MS_CURRMTDAMT], the filter ("202202") applied to VW_CALENDAR_FISCALPERIOD[POSTINGPERIOD] will be applied to VW_NS_TRANSACTION[POSTING_PERIOD].

 

Similarly, for measure [MS_PRIOR_1_MTD], the filter ("202201") applied to VW_CALENDAR_FISCALPERIOD[POSTINGPERIOD_PRIOR_1] will be applied to VW_NS_TRANSACTION[POSTING_PERIOD].

 

Like this:

vkkfmsft_0-1649728640608.png

 

But your VW_NS_TRANSACTION[POSTING_PERIOD] does not contain the row with the value 202201, so measure [MS_PRIOR_1_MTD] returns blank.

 

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.