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

Be 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

Reply
I_LOVE_POWER_BI
Helper III
Helper III

Running Prices in filter context with different granularities

So here is my business scenario:

  • I have negotiated prices for certain periods on Material Type level
  • Based on the column Order Priority the to-use Material Type is defined on the higher Material Master level

I_LOVE_POWER_BI_0-1653466550128.png

In this case, "Sugar Type B" price shall be shown on Material Master Level (highlighted in green), because of the "1" in the order priority.

That worked fine based on this MEASURE:

 

Top Order Priortiy Price = 
VAR MinOrderPriority = MIN (Prices[Order Priority]) 
VAR Top1 = 
TOPN (
    1,
    VALUES ( Prices[Order Priority] ),
    [MinOrderPriority ],
    ASC
)
VAR Result = CALCULATE( [Material Price], Top1)
RETURN
Result

 

Next step, I add a running price. I repeat the last available negotiated price every month until a new negotiated price is available (to put it on a line chart, without blanks). In a table format it looks like this:

I_LOVE_POWER_BI_1-1653467047337.png

However, as you can see, the red highlighted result is not what I need. My goal is that the Material Type Price with the MIN Order Priority will always be shown on Material Master level. Right now this is not the case, because Sugar Type B has only a negotiated price in 2022-01, whereas Sugar Type A has negotiated price in 2022-04 - therefore starting 2022-04, the TOPN measure on Material Master will show Type A, due to the evaluation context. Here the MEASURE I used:

 

Top Order Priority Price Running = 
VAR LastNonBlankDate =
    CALCULATE (
        MAX ('Calendar'[Year Month]),
        FILTER (
            ALL ( 'Calendar'[Year Month] ),
            'Calendar'[Year Month] <= MAX ( 'Calendar'[Year Month] )
            && [Top Order Priority Price] <> 0
        )
    )
RETURN
    CALCULATE (
        [Top Order Priority Price],
        FILTER (
            ALL ( 'Calendar'[Year Month] ), 
            'Calendar'[Year Month] = LastNonBlankDate
        )
    )

 

In my mind the solution shouldn't be that complicated, I assume I should remove some filter context or use virtual tables somewhere....I am just too stupid I guess, can't produce a result that works after many many hours of failing....Also my goal is to use a measure without adding a physical table, in order to keep dynamic slicer possibilities and reduce storage. An additional column that somehow works would be fine of course...

Here again my desired outcome on only Material Master level:

I_LOVE_POWER_BI_2-1653467705017.png

Thanks a lot for your kind support!

 

1 ACCEPTED SOLUTION
I_LOVE_POWER_BI
Helper III
Helper III

Thank you! I solved it by now.

View solution in original post

2 REPLIES 2
I_LOVE_POWER_BI
Helper III
Helper III

Thank you! I solved it by now.

v-luwang-msft
Community Support
Community Support

Hi @I_LOVE_POWER_BI ,

Could you pls share your pbix file and remember to remove confidential data.

 

 

Best Regards

Lucien

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.