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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
nicolasvahidzei
Frequent Visitor

Filter by column and dynamic average

Hello everyone,

 

i was not able to find a solution online to my query. 

I have multiple trucks listed per licence plate and i have the days of the months numbered 1 through 31.

 

I want to add a slicer for the dates but they are column names and i am not sure how to do that. I need the selected date range to only show those selected date range and hide the others.

 

Once that is done a column should be added to calculate the average for that truck.

 

Is such an operation possible?

 

Thank you so much for your time.

 

001.PNG

002.PNG

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @nicolasvahidzei 
You need to unpivot your table from PQ ( The days must be on rows):

Ritaf1983_0-1722655376855.png

Change the column name for Day:

Ritaf1983_1-1722655461473.png

After closing and applying create the measure (not Calculated column) for the average :

Average_ = AVERAGE('Table'[Value])
And drag The vech, days and average to the matrix:
Ritaf1983_2-1722655714064.png

Add a slicer for days :

Ritaf1983_3-1722655774267.png

The pbix with the example is attached

Detailed guide to unpivot :
https://www.youtube.com/watch?v=tAIqopmj9RA&t=17s

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

4 REPLIES 4
Ritaf1983
Super User
Super User

Hi @nicolasvahidzei 
You need to unpivot your table from PQ ( The days must be on rows):

Ritaf1983_0-1722655376855.png

Change the column name for Day:

Ritaf1983_1-1722655461473.png

After closing and applying create the measure (not Calculated column) for the average :

Average_ = AVERAGE('Table'[Value])
And drag The vech, days and average to the matrix:
Ritaf1983_2-1722655714064.png

Add a slicer for days :

Ritaf1983_3-1722655774267.png

The pbix with the example is attached

Detailed guide to unpivot :
https://www.youtube.com/watch?v=tAIqopmj9RA&t=17s

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Thank you so much Rita, you are great. Do you freelance? Please send me a whatsapp or email nicolas  zein (attached) at google gmail. Cheers.

Hi Nicolas,
1. Happy to help 🙂
2. I work at a project-based company, I'm not a freelancer. You can check my LinkedIn:
https://www.linkedin.com/in/rita-fainshtein/

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

I added you, let's chat on linkedin.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.