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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
MarcRichards
New Member

Ave Quote Volume Per Sales/Work day DAX Formula (Multiple states)

Hi All,

 

I have some quote data that I'm trying to present as an average for each month, based on the number of 'work days' that have elapsed during the month, when the report is refreshed.

There are also multiple states and products to filter.

 

Here is my current attempt at a DAX formula, which isn't giving me the correct figures:

 
Ave Quotes per Day =
VAR LastSalesDate =
CALCULATE ( MAX ( 'Quote Data'[OrderCreationDate] ), ALL ( ZCV_WORKDAYS ) )
RETURN
CALCULATE (
SUMX (
VALUES ( 'Quote Data'[SoldToSalesOffice] ),
CALCULATE (
DIVIDE (
SUM ( 'Quote Data'[OrderQuantityEBR] ),
MAX(ZCV_WORKDAYS[WorkdayInteger])
)
)
),
KEEPFILTERS ( ZCV_WORKDAYS[Date] <= LastSalesDate )
)

 

 

These are the relationships, between the data/ reference tables:

...and this is the ZCV_WORKDAYS ref table (each state has its own workdays):

ZCV_WORKDAYS Table.JPG

1 ACCEPTED SOLUTION

@amitchandak  I've just realised that it is working.
My reference table has 22 work days in it, when it should only have 15.

Sorry for the inconvenience!

 

Marc

View solution in original post

4 REPLIES 4
MarcRichards
New Member

ok - the relationship table didn't seem to post...here it is:

Relationships.JPG

Try with

FILTERS (ZCV_WORKDAYS, ZCV_WORKDAYS[Date] <= LastSalesDate )

in place of KEEPFILTERS ( ZCV_WORKDAYS[Date] <= LastSalesDate )

 

Also why Max has been taken for workdays. Hope this is the, max no of workdays.

 

Can you please share what is expected and what you are getting.

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Hi @amitchandak, thanks for the prompt response.

I'm currently getting the below: 261,285 (vol for Dec is 5,748,262, divided by 15 sales days = 383.217)

Current Ave Graph.JPG

 

 

 

 

 

 

 

 

When I try to replace my 'keepfilters' line with your proposed line, I get the following error:
"Too many arguments were passed to the FILTERS function. The maximum argument count for the function is 1."

 

MAX was to try and get the latest work day.

I think I may have to start this from scratch/ rethink how I'm calculating this average...shouldn't be this hard!

 

Marc

@amitchandak  I've just realised that it is working.
My reference table has 22 work days in it, when it should only have 15.

Sorry for the inconvenience!

 

Marc

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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