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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
LayneCobain
Frequent Visitor

Fill blank with values the month before

Hey guys,

 

I need some help:

LayneCobain_0-1673287769576.png

As you can see, I have an example with 2 products with different prices over the year and the previous year.

The matrix shows following measures:

 

This one shows the maximum price per month

 

Last Price = MAX ( Daten[Preis] )

 

 

This one shows the price of the product previous year in the same month:

 

PricePreviousYear = 
    CALCULATE(
        MIN(Daten[Preis]),
        SAMEPERIODLASTYEAR(Kalender[Datum])
    )

 

 

As you can see in the matrix there are some months the previous year without a price. I want to fill this up with the price the month before.

Example: Product A had a price of 60 in January previous year and I want to fill up February with this value.

 

How can I do this?

 

The fill up / down does not work, I need a measure.

 

Thank you guys!

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

Hi @LayneCobain ,

I have created a simple sample , please refer to my pbix file to see if it helps you.

Create a measure.

Measure =
IF (
    [pricepreviousyear measure] <> BLANK (),
    [pricepreviousyear measure],
    CALCULATE (
        [pricepreviousyear measure],
        'Table'[date] = EDATE ( MAX ( 'Table'[date] ), -1 )
            && 'Table'[Monat product] = MAX ( 'Table'[Monat product] ),
        ALLEXCEPT ( 'Table', 'Table'[date] )
    )
)

vpollymsft_0-1673319617099.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

1 REPLY 1
v-rongtiep-msft
Community Support
Community Support

Hi @LayneCobain ,

I have created a simple sample , please refer to my pbix file to see if it helps you.

Create a measure.

Measure =
IF (
    [pricepreviousyear measure] <> BLANK (),
    [pricepreviousyear measure],
    CALCULATE (
        [pricepreviousyear measure],
        'Table'[date] = EDATE ( MAX ( 'Table'[date] ), -1 )
            && 'Table'[Monat product] = MAX ( 'Table'[Monat product] ),
        ALLEXCEPT ( 'Table', 'Table'[date] )
    )
)

vpollymsft_0-1673319617099.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.