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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to Remove a monthly filter and apply a yearly filter

Hi,

 

I need to compare Bonuses (reported yearly ) and annual salaries (reported monthly. The amounts vary each month due to employees changes.).

 

The way things are, I have to use a slicer of "Year-Month" to choose Dec-16 or Dec-17.

I need the Bonus measure to aggregate the whole corresponding year (ie 2016 or 2018).

How should I compose my DAX formula?

Upon selecting Dec-16 from the "Month-Year" Slicer, I want the Salaries to show just that (which it does) and I want all(!) the Bonuses are given on the year to be aggregated. 

I created the measure with the hard-coded year 2016 for example but even that gives me an error:

Capture.PNG

TotBonusLocAllYear = SUMX(FILTER(ALL(dimCalendar[MonthYear]), YEAR(factsBonuses[Effective Date])=2016),[TotBonusLoc] )

 

Thanks,

Tamir

 

 

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi Tamir,

 

You can use function All to clear the filter from monthly slicer. The formula could be like this:

TotBonusLocAllYear =
CALCULATE (
    SUM ( factsBonuses[Bonuses] ),
    FILTER ( factsBonuses, factsBonuses[Effective Date] = 2016 ),
    ALL ( dimCalendar[MonthYear] )
)

Or this:

TotBonusLocAllYear =
CALCULATE ( SUM ( factsBonuses[Bonuses] ), ALL ( dimCalendar[MonthYear] ) )

If you want more accurate formula, please provide a dummy sample.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you Dale,

In the suggested DAX, how can I instruct the Measure to apply the Year of the selected month (from the slicer)?

 

TotBonusLocAllYear =
CALCULATE ( SUM ( factsBonuses[Bonuses] ), ALL ( dimCalendar[MonthYear] ) )

Meaning, I have a Month-Year Slicer, When I click on Dec-2016 or Sep-2016 I want the value 2016 go into the DAX. 

 

I also tried: 

TotBonusLocAllYear3 = CALCULATE(
                            SUM(factsBonuses[Payment Amount]), 
                            ALL(dimCalendar[MonthYear]), 
                            FILTER(dimCalendar,dimCalendar[Year]=ENDOFYEAR(dimCalendar[Date]))
                            )

Which returns blank!

 

 

Thank you,

Tamir

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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