Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.