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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Agaidar
Helper I
Helper I

Average by Product and Week Type

Hello Team,

 

I apologize if this question has already been addressed, but I haven't been able to find a solution. I've been struggling with this issue for the past couple of days and it's causing me quite a headache. Could you please assist me in achieving the result in the last column using either a measure or a column? Thank you in advance for your assistance.

 

ProductWeeksWEEK TYPEPriceSalesAverage per Product on SHELF WEEK
AB21-Oct-24SHELF$10.010,00010,000
AB28-Oct-24SHELF$10.010,00010,000
AB18-Nov-24PROMO$5.020,00010,000
BB21-Oct-24SHELF$8.040,00040,000
BB28-Oct-24SHELF$8.040,00040,000
BB18-Nov-24PROMO$4.080,00040,000
1 ACCEPTED SOLUTION

Hi @Agaidar ,

Thank you for your feedback.  I've redone the calculated column to produce your required output.  

DataNinja777_0-1716025307629.png

I also attach the pbix file as an example.  

Best regards,

View solution in original post

4 REPLIES 4
v-yaningy-msft
Community Support
Community Support

Hi, @Agaidar 

You can refer to @DataNinja777 reply. If it does not work, you can try the following measure.

vyaningymsft_0-1716182733353.png

MEASURE:

Average per Product on SHELF WEEK 1 = 
VAR _product =
    SELECTEDVALUE ( 'Table'[Product] )
VAR _result =
    CALCULATE (
        SUMX (
            FILTER (
                ALL ( 'Table' ),
                'Table'[Product] = _product
                    && 'Table'[WEEK TYPE] = "SHELF"
            ),
            'Table'[Price] * 'Table'[Sales]
        )
            / SUMX (
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[Product] = _product
                        && 'Table'[WEEK TYPE] = "SHELF"
                ),
                'Table'[Price]
            )
    )
RETURN
    _result

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

DataNinja777
Super User
Super User

Hi @Agaidar ,

 

Are you trying to calculated the weigted average of the products over different weeks?  In that case, it can be calculated in the following mannter as an example.  

 

DataNinja777_0-1716010063524.png

If you you required output is different one, please let me know. 

I attach an example pbix file.  

Best regards,

Hi,

 

Thanks for looking on this. Unfortunately this is not what I'm looking for. I need result exactly as in column [Average per Product on SHELF WEEK]

Hi @Agaidar ,

Thank you for your feedback.  I've redone the calculated column to produce your required output.  

DataNinja777_0-1716025307629.png

I also attach the pbix file as an example.  

Best regards,

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors