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

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

Reply
Robert1981
Helper III
Helper III

How to display a comparison when the key value doesn't exist for 1 of the 2 periods?

I have a manufacturing report and I want to do the price and volume variance calculations.

I have in 1 table all details for:
Plant  - Material - Resource - Produced QTY - Consumed QTY - Consumed Cost - EOM date

1234 - D12345678 - Production - 100 -       -           - 8/31/23

1234 - D12345678 - A9874214  -        - 50   - $150  - 8/31/23

1234 - D12345678 - A9874215  -        - 25   - $450  - 8/31/23

1234 - D12345678 - A9874216  -        - 10   -   $12  - 8/31/23

1234 - D12345678 - A9874217  -         - 5   -    $50  - 8/31/23

1234 - D12345678 - Production -   70 -       -            - 7/31/23

1234 - D12345678 - A9874214  -        - 25   - $175  - 7/31/23

1234 - D12345678 - A9874215  -        - 20   - $350  - 7/31/23

1234 - D12345678 - A9874216  -        - 12   -   $16  - 7/31/23

1234 - D12345678 - A9874217  -          - 2   -    $50  - 7/31/23

1234 - D12345677 - Production - 100 -        -           - 7/31/23

1234 - D12345677 - A9874214  -        - 50   -  $150  - 7/31/23

1234 - D12345677 - A9874215  -        - 25   - $450  - 7/31/23

1234 - D12345677 - A9874216  -        - 10   -    $12  - 7/31/23

1234 - D12345677 - A9874217  -         -  5   -    $50  - 7/31/23

The Resource column either indicates's  if the line represents production or consumed Raw material code
In the display visual I set up a time slicer to determine the period I want to compare. If I select August, I would automatically compare with July. I build the formulas to do price and volume variance considering the selected month and the corresponding selected comparison month.

 

In the above example it works perfectly for material D12345678 since we have data in both periods 7/31 and 8/31. But for D12345677 there is no 8/31 data. It won't create my variance, because there is no D12345677. How do I create the variance regardless. 

My initial thought was to create a union of the master data in the table (Plant, Material, Resource) with the Date table. But that sounds convoluted. 

Is there a better way?

1 REPLY 1
amitchandak
Super User
Super User

@Robert1981 , one of the ways is get the value of any month before

 

calculate(lastnonblankvalues(Date[Month Year Sort], Sum(Table[Value]) ), Filter(all(Date), Date[Date] < Min(Date[Date]) ))

 

 

or when you take diff uses like

 

divide([This month]-[Last month], [Last Month])

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.