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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
santi17
Frequent Visitor

Divide by Date slicer

Hi, I need help with this case.

 

santi17_0-1691998762043.png

 

Stock = Current stock
Sold = Sold value will change following the control date. (This one not the problem)
--

Average Sales is problem.
What I want to do in Average Sales:
If Control Date 7/1/23 - 7/31/23 is 31 Days
Average Sales = Sold/31
If Control Date 7/1/23 - 7/7/23 is 7 Days
Average Sales = Sold/7

Basically, the Control Date will be the divisor for the value Sold and become Average Sales

--

Stock/AVG = Current Stock divine by Average Sales

--

 

 

 

 

5 REPLIES 5
eliasayyy
Memorable Member
Memorable Member

to fin the number of days , simply use a countrows function 

COUNTROWS('table of your slicer[date]))

then do a sold/[new measure]

gregoliveira
Helper II
Helper II

Hi!

 

I can see two ways to achieve the solution

 

First:

 

Avg Sales = DIVIDE ( SUM ( Sales ) , COUNTROWS ( Calendar_Table )  )

 

Second,

 

Avg Sales = AVERAGEX ( VALUES ( Calendar_Table[Date] ), SUM ( Sale ) )

Hi Grego,

 

Not working well.
It's possible to count value Slincer?

santi17_0-1692002270199.png

I have try to count range 7/2/2023 tp 7/12/2023 but its count 31..
I use this mesaure:

controldate = COUNTROWS(VALUES(itemLedgerEntries[postingDate].[Day]))

No. You will need to create a calendar table. I believe finishing this measure using the automatic date hierarchy will be very hard.

Thanks Grego..
So If We can't measure using the automatic date. Can we divide it by the picked value?

santi17_2-1692003851935.png

 

I just create "Divide Average" Table

And inside it only 1 column and with value row 7,10,15 &30

santi17_1-1692003771576.png

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.