cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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()
)

View solution in original post

5 REPLIES 5
Highlighted
Community Champion
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. 


If you found this post helpful, please give Kudos.


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

morgtd30_0-1594126475967.png

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
Super User IV

Re: Help with filtering out measure

@morgtd30 , use is filtered

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


Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
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:

morgtd30_0-1594127637491.png

 

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()
)

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

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

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Get Ready for Power BI Dev Camp

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.

Power BI Desktop August 2020 Update

Power BI Desktop August 2020 Update

We have great updates this month! Click the link for the video with more info.

Top Solution Authors
Top Kudoed Authors