Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Filter contex problem

Hi, I have a measure that calculates the average expense per month per selected period.

 

I would like to avoid being filtered by other time slicers on the page. 

 

My goal is to have a bar chart with the X showing expense categories, Y showing the amount and as input value:

1. the total expense for the selected period according to the slicer (here I will select a specific year and specific month)

2. My measure returning what is the average expense per month for the selected period (here I want to return the average expense per month for the select year)

 

I hope that I have explained myself. Currently, if I add both measures to the graph I am getting the same values because my measure is calculating the average of the selected month which ofc is the same as the total of the month.

 

Thank you for the help!

 

below the code of my measure and an image to explain my goal:

 

 

WA Monthly = 
VAR AnnualAmount =
    CALCULATE(
        [Net Amount TOT],
        ALL(
            DateTable[Date])
    )
VAR MonthlyTable =
    ADDCOLUMNS(
        SUMMARIZE(
            Merged_Final,
            DateTable[Year],DateTable[Month]
        ),
        "MonthlySales",[Net Amount TOT],
        "Wt",[Net Amount TOT]/AnnualAmount
    )
VAR WA_Monthly =
    SUMX(
        MonthlyTable,
        [Wt]*[MonthlySales]
    )
RETURN
ABS(WA_Monthly)

 

 

1 Reply