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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors