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
LJAdmin
Regular Visitor

Keep Contest Filter after Caculate with Filter

Hi,

 

i've a measure defined like this:

 

T_QTA_VENDUTA_SP = CALCULATE(SUM(DM_RETAIL_PRODUCTS[QTA_VENDUTO]),FILTER(ALL(DM_RETAIL_PRODUCTS),MAX(DM_RETAIL_PRODUCTS[STAGIONE_VENDITA]) = DM_RETAIL_PRODUCTS[STAGIONE_VENDITA]+10))
 
This allowed my to calculate the qty sold in a previous season:
 

Annotazione 2020-08-11 115912.png

 

The "Previous" term means SEASON - 10.

 

Now, if i want to add another detail level, like the Month, this is what i got:

 

Annotazione 2020-08-11 120211.png

 

The Measure won't split by month, i get the total instead.

Is there a way to use the Caculate function with the filter clause, but in the sametime maintain the context of the table ( or visual)

where the Measure is placed?

 

Thanks in advance for help,

Best Regards

--D

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @LJAdmin ,

 

Try to modify your measure as below:

 

T_QTA_VENDUTA_SP = CALCULATE(SUM(DM_RETAIL_PRODUCTS[QTA_VENDUTO]),FILTER(ALL(DM_RETAIL_PRODUCTS),DM_RETAIL_PRODUCTS[STAGIONE_VENDITA]=MAX(DM_RETAIL_PRODUCTS[STAGIONE_VENDITA])+10))

If the above doesnt work,could you pls upload your .pbix file to onedrive and share the link with us?Remember to remove the confidentail information.

 

 
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

 

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi @LJAdmin ,

 

Try to modify your measure as below:

 

T_QTA_VENDUTA_SP = CALCULATE(SUM(DM_RETAIL_PRODUCTS[QTA_VENDUTO]),FILTER(ALL(DM_RETAIL_PRODUCTS),DM_RETAIL_PRODUCTS[STAGIONE_VENDITA]=MAX(DM_RETAIL_PRODUCTS[STAGIONE_VENDITA])+10))

If the above doesnt work,could you pls upload your .pbix file to onedrive and share the link with us?Remember to remove the confidentail information.

 

 
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

 

amitchandak
Super User
Super User

@LJAdmin , You can create rank for the session. and Use that. But create a separate session table

 

This Session = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Session Rank]=max('Date'[Session Rank])))
Last Session = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Session Rank]=max('Date'[Session Rank])-1))

 

Something very smiliar to

https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...

AntrikshSharma
Community Champion
Community Champion

Use something like this:

=
CALCULATE ( [Total Sales], DATEADD ( Dates[Date], -10, MONTH ) )

 

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.