cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## Help with filtering out measure

I have a slicer option that is "6/1/2020". When de-selected I need it to turn both measures blank.

JunProj = CALCULATE(SUM(Projections[Amount]), Projections[Month] = "6/1/2020")

I have another measure that also needs to be controlled by this filter. It combines JunProj and any actual sales before that date. It's a mess but I've been having trouble figuring this out:

Jun 20 = TOTALYTD([JunProj], 'Date'[Date])

+

IF(AND(

calculate(sum(

Opportunity[Amount]),Opportunity[StageName]="Closed Won",Opportunity[CloseDate]<date(2020,6,1))

= TOTALYTD([JunProj], 'Date'[Date]),

CALCULATE([JunProj]>date(2020,6,1))=BLANK()),

BLANK(),

TOTALYTD(CALCULATE(SUM(Opportunity[Amount]),Opportunity[StageName]     = "Closed Won",Opportunity[CloseDate] < DATE(2020,6,1)) , 'Date'[Date])

)

It still displays data prior to 2020,6,1:

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

## Re: Help with filtering out measure

I was able to solve the problem with the following formula:

Apr Projection =
TOTALYTD([AprProj], 'Date'[Date])
+
IF(
COUNTROWS(
FILTER(
MonthTable,
MonthTable[ProjectionMonth] = "4/1/2020")
) >0,

TOTALYTD(CALCULATE(SUM(Opportunity[Amount]),Opportunity[StageName] = "Closed Won",Opportunity[CloseDate] < DATE(2020,4,1)) , 'Date'[Date]),BLANK()
)
5 REPLIES 5
Highlighted
Community Champion

## Re: Help with filtering out measure

Calculate context transition is tricky, so you'll get the Jun value no matter what is selected in slicer.

Try: JunProj = SUMX(FILTER(Projections, Projections[Month] = "6/1/2020"), Projections[Amount])

What is it you're actually wanting to achieve though? I question why a slicer selection should render a measure to be blank, and why you're creating measures with such specific dates hard coded into them? Can you provide dummy data of your sample model and explain what you need?

______________

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved.

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query.

excelwithallison.com

Highlighted
Frequent Visitor

## Re: Help with filtering out measure

Here's what the line graph looks like. I'm building a way to compare YTD projections for any given current or historical month. The 6/1/2020 is one of many filters to remove the lines off the graph as necessary. The green line is the current YTD. It works great other than those amounts that still show up even after the month is filtered out. It causes the tool-tip to fill with bad data.

Highlighted
Super User IV

## Re: Help with filtering out measure

@morgtd30 , use is filtered

``if(ISFILTERED('Jun'[slicer]),[junproj],blank())``

My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Highlighted
Frequent Visitor

## Re: Help with filtering out measure

Also to be clear it's June 20 that is still displaying data:

Highlighted
Frequent Visitor

## Re: Help with filtering out measure

I was able to solve the problem with the following formula:

Apr Projection =
TOTALYTD([AprProj], 'Date'[Date])
+
IF(
COUNTROWS(
FILTER(
MonthTable,
MonthTable[ProjectionMonth] = "4/1/2020")
) >0,

TOTALYTD(CALCULATE(SUM(Opportunity[Amount]),Opportunity[StageName] = "Closed Won",Opportunity[CloseDate] < DATE(2020,4,1)) , 'Date'[Date]),BLANK()
)

Announcements

#### August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

#### July 2020 Community Highlights

Learn about the exciting things that happened in July.

#### Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.