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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Arlind_Selimaj
Frequent Visitor

Average per each product by filtered month

Hi,

 

I am having difficulties creating a measure which finds the average price per product by month.

I want to find a way to have DAX group by product, and then find the average price of which each of the products individually has been purchased during the whole month. The measure i have created simply returns the price per day, and does not account for the average of all prices. Please note i have a Filter active which filter for month (january in this case)

My measure is:

Arlind_Selimaj_2-1715197644743.png

Arlind_Selimaj_1-1715197593059.png

 

 

 

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

Hi,@Arlind_Selimaj.Hello, @amitchandak .Thank you very much for the help of the problem.
I am glad to help you.
How,I want share another solution  of mine with you.

According to your description, you want to create a measure to calculate the average purchase amount for each product in the filtered month, given that the date filter already exists?

You can try the following DAX code:

Measure_ = 
CALCULATE(
    AVERAGE('Table'[Price per unit]),
    FILTER(ALLSELECTED('Table'),'Table'[Product name]=MAX('Table'[Product name]))
)

Here is my test data:

vjtianmsft_0-1715222732584.pngvjtianmsft_1-1715222742076.png

 



vjtianmsft_2-1715222749996.pngvjtianmsft_3-1715222761635.png

 

vjtianmsft_4-1715222779167.png

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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






View solution in original post

2 REPLIES 2
v-jtian-msft
Community Support
Community Support

Hi,@Arlind_Selimaj.Hello, @amitchandak .Thank you very much for the help of the problem.
I am glad to help you.
How,I want share another solution  of mine with you.

According to your description, you want to create a measure to calculate the average purchase amount for each product in the filtered month, given that the date filter already exists?

You can try the following DAX code:

Measure_ = 
CALCULATE(
    AVERAGE('Table'[Price per unit]),
    FILTER(ALLSELECTED('Table'),'Table'[Product name]=MAX('Table'[Product name]))
)

Here is my test data:

vjtianmsft_0-1715222732584.pngvjtianmsft_1-1715222742076.png

 



vjtianmsft_2-1715222749996.pngvjtianmsft_3-1715222761635.png

 

vjtianmsft_4-1715222779167.png

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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






amitchandak
Super User
Super User

@Arlind_Selimaj , Try one of the two

 


AVERAGEX(
Values( '1.date[Month Year]'), calculate(Sum('All Product'[Price per unit]))
)

 

or


AVERAGEX(
Summarize('All Product', 'All Product'[Product] , '1.date[Month Year]'), calculate(Sum('All Product'[Price per unit]))
)

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Kudoed Authors