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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.