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

Context filter for measure

I created a Moving Average Measure like 

MA (7) = CALCULATE(sum(Item[Valor]);DATESINPERIOD('Calendar'[Date];LASTDATE('Calendar'[Date]);-7;DAY))/(CALCULATE(AVERAGE('Working_days'[DU_7])));

 

But it doesn´t correspond to my context filter. Whe I select some columns it still giving me the same results. I have two other columns I would like to slice (Product, Client).

 

How can I use context filter to my calculated field  (column or measure) ?

1 ACCEPTED SOLUTION
v-ljerr-msft
Employee
Employee

@alissker


How can I use context filter to my calculated field  (column or measure) ?


How context filter works depends on the relationships between your tables.  What are the relationships between your tables? Based on DAX, it should have no issue on your calculation logic. Could you post your table structure and some sample data in your case? It's better if you could upload a pbix file.

 

References:

Row Context and Filter Context in DAX

Create and manage relationships in Power BI Desktop

 

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Employee
Employee

@alissker


How can I use context filter to my calculated field  (column or measure) ?


How context filter works depends on the relationships between your tables.  What are the relationships between your tables? Based on DAX, it should have no issue on your calculation logic. Could you post your table structure and some sample data in your case? It's better if you could upload a pbix file.

 

References:

Row Context and Filter Context in DAX

Create and manage relationships in Power BI Desktop

 

Regards

BhaveshPatel
Community Champion
Community Champion

For Correct DAX Pattern of Moving Average,

 

Please follow below links for exact solution.

Link 1

Link 2

Link 3

 

 

Thanks & Regards,

Bhavesh

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

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.