cancel
Showing results for
Did you mean:
Frequent Visitor

## Calculate weekdays lapsed, but with a twist

Hi all... I am a new PBI user and would love some support on an issue I can't resolved (despite reading through similar Q&A posts)...

I have daily sales data loaded in my model, and am trying to calculate a simple average daily sales by weekday (* we only sell during Mon-Fri). I already have a "IsWorkingDay" column in my date table, and have attempted to create the following measure:

```No of Sales Days Lapsed = CALCULATE(
SUM('Date Dimension'[IsWorkingDay]),
DATESBETWEEN('Date Dimension'[FullDate],
STARTOFMONTH('Date Dimension'[FullDate]),
LASTDATE(Sales[Invoice Date])))```

This measure gives me an expected return value of "10" (i.e. I have sales loaded for 1 Oct 2019 to 14 Oct 2019, so that consisted of  10 weekdays in that period). But here is my problem..... when I add in a matrix of my sales broken down by customer, I am getting the following:

 Customer ACT Nett Sales # of Sales Days Lapsed # of Weekdays in Mth Extrapolated Full Month Sales Customer #1 \$29,000 10 23 \$66,700 Customer #2 \$22,000 10 23 \$50,600 Customer #3 \$34,000 6 23 \$130,333 Customer #4 \$11,000 10 23 \$25,300 Customer #5 \$7,500 10 23 \$17,250 Customer #6 \$6,800 10 23 \$15,640 TOTAL \$110,300 \$305,823

The problem with Customer #3 is that unlike all other customers who purchased every weekday so far this month, he only purchased on 6 weekdays.

As I am now trying to extraplate my MTD sales to the full month, it is giving me a false/inflated estimate of my forecasted sales.

How do I modify my DAX so that my [No of Sales Days Lapsed] measure simply takes the latest date within my sales table, regardless of any attribute (e.g. customer, product type, store location, etc.),then minus the start of the month selected, and then work out the number of weekdays lapsed?

Anthony

1 ACCEPTED SOLUTION

Accepted Solutions
Frequent Visitor

## Re: Calculate weekdays lapsed, but with a twist

No worries @Greg_Deckler . I will re-draft my data and submit again (* in the right format and forum).

Thanks.

4 REPLIES 4
Super User IV

## Re: Calculate weekdays lapsed, but with a twist

Second, See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...

---------------------------------------

Not the Power BI thought police...

##### I have NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Datanaut!

Frequent Visitor

## Re: Calculate weekdays lapsed, but with a twist

Sorry @Greg_Deckler , new to PBI and this forum, so didn't mean to break the rules. I now realised that I posted to the wrong section, but have no idea how to edit (* might delete and re-post if required).

I did have a look at your link, but I must admit I do not understand how it can resolve my issue. I am pretty green at PBI, so can you please point me down to the right path?

As explained in my initial post, I can get it 99% right. The hurdle is when I dissect my sales data (e.g. by customer), and that my lapsed working days measure fail in instances where the customer did not buy every single weekday.

Super User IV

## Re: Calculate weekdays lapsed, but with a twist

Oh, it's not so much about any rules but more about the fact that without some sample source data, it is incredibly difficult to replicate your issue and troubleshoot. That was the main point of referring you to the "How to" article.

---------------------------------------

Not the Power BI thought police...

##### I have NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Datanaut!

Frequent Visitor

## Re: Calculate weekdays lapsed, but with a twist

No worries @Greg_Deckler . I will re-draft my data and submit again (* in the right format and forum).

Thanks.

Announcements

#### New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

#### ‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

#### Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

#### Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

#### Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors