cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
iab_pbi
Helper I
Helper I

Using ALL() but Measure is still being filtered by Slicer/Column

I have this measure built out to calculate an account's exposure in the prior quarter:

 
Prior Qtr Exposure =
var currentqtr = MAX(Account_Data_Total[Quarter])
var priorqtr = CALCULATE(MAX(Account_Data_Total[Quarter]),Account_Data_Total[Quarter]<>currentqtr)
return
CALCULATE(SUMX(Account_Data_Total,Account_Data_Total[Exposure]),Account_Data_Total[Quarter]=priorqtr)
 
The measure works, except when I add the column "Exposure Bucket" to the table, and then the prior quarter exposure doesn't calculate for the accounts in which the exposure changed from one exposure bucket in one quarter to another bucket in the next quarter.
 
I tried using ALL(Exposure Bucket), but it didn't solve anything.  
1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @iab_pbi ,

 

You will need to add ALL() function when calculating priorqtr.
And if you want previous quarter, you might consider to use "<" instead of "<>".

 

Measure =
var currentqtr = MAX(Account_Data_Total[Quarter])
var priorqtr = CALCULATE(MAX(Account_Data_Total[Quarter]),FILTER(ALL(Account_Data_Total),Account_Data_Total[Quarter]<currentqtr))
return
priorqtr

 

Capture.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
iab_pbi
Helper I
Helper I

Thank you so much for the advice, this worked very well!

 

v-jayw-msft
Community Support
Community Support

Hi @iab_pbi ,

 

You will need to add ALL() function when calculating priorqtr.
And if you want previous quarter, you might consider to use "<" instead of "<>".

 

Measure =
var currentqtr = MAX(Account_Data_Total[Quarter])
var priorqtr = CALCULATE(MAX(Account_Data_Total[Quarter]),FILTER(ALL(Account_Data_Total),Account_Data_Total[Quarter]<currentqtr))
return
priorqtr

 

Capture.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@iab_pbi , Not very clear. First of use time intelligence for this

 

example

 

QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))
Last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))

 

 

Also for what you have in this period , what you had in last period

follow the same approach using QTD and account and bucket

 

Customer Retention Part 1:
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/b...

 

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!
!! Subscribe to my youtube Channel !!

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Power BI Dev Camp Session 22 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!