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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
zenonsbelskiss
Frequent Visitor

Filter for a measure similar to a filter for visualization

Hello, PowerBI Gurus,

 

So I have a simple measure that computes a forecast for the selected period. When I use a card visualization and apply a filter to it it works just fine. However, if I need to use the measure in other calculations, then the filter which I applied to the card gets lost.

 

My question is: How do I incorporate the filter directly into the measure? (I need a filter that filters out just the chosen year)

 

Here is my measure:

Forecast 2019 = CALCULATE(SUM(MANAGERS[Plan 2019])/12, ALL())*DISTINCTCOUNT(SALES[Year-Month])

 

Thank you in advance,

PowerBI beginner.

2 REPLIES 2
v-xicai
Community Support
Community Support

Hi @zenonsbelskiss ,

 

You may change the measure like DAX below, which uses ALLSELECTED function to catch the filter.

 

 

Forecast 2019 =
CALCULATE ( SUM ( MANAGERS[Plan 2019] ) / 12, ALLSELECTED ( MANAGERS ) )
    * CALCULATE ( DISTINCTCOUNT ( SALES[Year-Month] ), ALLSELECTED ( SALES ) )

 

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

Fowmy
Super User
Super User

@zenonsbelskiss 

I don't have enough information about your model, try this measure if it can be used. I supposed you have Dates table

Forecast 2019 = 
VAR __YEAR = SELECTEDVALUE(DATES[Year]) RETURN
CALCULATE(
    SUM(MANAGERS[Plan 2019])/12, 
    DATES[Year] <> __YEAR
)
*
DISTINCTCOUNT(SALES[Year-Month])

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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