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

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

Reply
KBIReports
Frequent Visitor

Ignore slicer in weighted average calculation

Hello,

 

I need to create a weighted average measure in a matrix that ignores a slicer on the page. The matrix should contain Wtd Avg THC by Strain for a specific date and a WTD Avg THC by Strain across all States and All Dates. The report contains a slicer Date slicer WeekOf. The weighted average formula works as expected, however, I cannot get the new measure to ignore the WeekOf slicer. Below is formula:

 

Average of THC weighted by Grams =
VAR __CATEGORY_VALUES = VALUES('AllLab'[Harvest])
RETURN
    DIVIDE(
        SUMX(
            KEEPFILTERS(__CATEGORY_VALUES),
            CALCULATE(AVERAGE('AllLab'[THC]) * SUM('AllLab'[Grams]),ALL(AllLab[WeekOf]),AllLab[Type]="Flower")
        ),
        SUMX(KEEPFILTERS(__CATEGORY_VALUES), CALCULATE(SUM('AllLab'[Grams]),ALL(AllLab[WeekOf]),AllLab[Type]="Flower"))
    )

 

I need to display the results in a matrix with Strain as the rows. Unfortunately the This Week Avg THC and All Avg THC are the same value which indicates to me that it is not ignoring the slicer. Any help would be much appreciated. 

 

3 REPLIES 3
Anonymous
Not applicable

Hi @KBIReports ,

 

Try to modify your formula like below:

1 = 
VAR __CATEGORY_VALUES =
    VALUES ( 'AllLab'[Harvest] )
RETURN
    DIVIDE (
        SUMX (
            __CATEGORY_VALUES,
            CALCULATE (
                AVERAGE ( 'AllLab'[THC] ) * SUM ( 'AllLab'[Grams] ),
                REMOVEFILTERS ( 'AllLab'[WeekOf] ),
                'AllLab'[Type] = "Flower"
            )
        ),
        SUMX (
            __CATEGORY_VALUES,
            CALCULATE (
                SUM ( 'AllLab'[Grams] ),
                REMOVEFILTERS ( 'AllLab'[WeekOf] ),
                'AllLab'[Type] = "Flower"
            )
        )
    )

vkongfanfmsft_0-1724923810379.png

Best Regards,
Adamk Kong

 

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

 

Hi @v-kongfanf-msft. I used your suggested formula. The first strain displayed the weighted average ignoring the slicer but the second strain is not ignoring the week selected. Below are images of the data: 

 

KBIReports_3-1725026894645.png

KBIReports_4-1725027192123.png

 

 

 

Hi @v-kongfanf-msft. I used your suggested formula. The first strain displayed the weighted average ignoring the slicer but the second strain is not ignoring the week selected. Below are images of the data: 

 

KBIReports_3-1725026894645.png

KBIReports_4-1725027192123.png

 

 

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors