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
dbarseg1
Frequent Visitor

calculate daily sales when drilling down time in a column chart

Hi everyone, 

 

I am looking to calculate average daily sales in cards (shown below) based on the time slicers selected:

dbarseg1_1-1720567857446.png

 

dbarseg1_0-1720567771849.png
Currently, my measure is: 

AvgDailySales =
    DIVIDE(
        SUM('BSF Files'[12. Sum of Extended Price]),
        DISTINCTCOUNT('Fiscal Calendar'[Date])
    )
This works correctly when the year is selected, but when the quarter or month is selected it is incorrect; it will divide the revenue for that quarter or month by ~365 days- or whatever is in the disctinct count of the total fiscal calendar date. 
Essentially, I would expect the average daily sales to be around the same in a quarter or month as it is in the year, however, the number is always extremelt low when quarter or month is selected because the more granular revenue is being divided by the same denominator as a year.  

Any help is very appreciated. 

 

2 ACCEPTED SOLUTIONS
aduguid
Solution Sage
Solution Sage

try this measure

AvgDailySales = 
    DIVIDE(
        SUM('BSF Files'[12. Sum of Extended Price]),
        COUNTROWS(VALUES('Fiscal Calendar'[Date]))
    )

View solution in original post

v-tangjie-msft
Community Support
Community Support

Hi @dbarseg1 ,

 

Thanks @aduguid  for the quick reply. Please allow me to provide additional insights:

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1720593834577.pngvtangjiemsft_1-1720593845466.png

(2) We can create a measure.

Avg sales = AVERAGEX(ALLSELECTED('BSF Files'),[12. Sum of Extended Price])

(3) Then the result is as follows.

vtangjiemsft_0-1720593968994.pngvtangjiemsft_1-1720593981098.png

 

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

4 REPLIES 4
v-tangjie-msft
Community Support
Community Support

Hi @dbarseg1 ,

 

Thanks @aduguid  for the quick reply. Please allow me to provide additional insights:

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1720593834577.pngvtangjiemsft_1-1720593845466.png

(2) We can create a measure.

Avg sales = AVERAGEX(ALLSELECTED('BSF Files'),[12. Sum of Extended Price])

(3) Then the result is as follows.

vtangjiemsft_0-1720593968994.pngvtangjiemsft_1-1720593981098.png

 

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

Hi Neeko, 
Thank you for the images and examples. By showing me the relationships in your tables, I understood that the issue was more with my calendar data than the formula. I changed what columns were shown in my slicers to be corresponding to the Fiscal Year calendar and this fixed the calculation. I followed the connection you made in your example data. 

Appreciate your help!!

aduguid
Solution Sage
Solution Sage

try this measure

AvgDailySales = 
    DIVIDE(
        SUM('BSF Files'[12. Sum of Extended Price]),
        COUNTROWS(VALUES('Fiscal Calendar'[Date]))
    )

Thank you! Once I fixed my calendar data relationship, this formula did the same thing as my prior formula. I sincerely appreciate your prompt reply!

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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

Top Solution Authors