cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alau
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:

 

  

CustomerACT Nett Sales# of Sales Days Lapsed# of Weekdays in MthExtrapolated Full Month Sales
Customer #1 $29,0001023 $66,700
Customer #2 $22,0001023 $50,600
Customer #3 $34,000623 $130,333
Customer #4 $11,0001023 $25,300
Customer #5$7,5001023 $17,250
Customer #6 $6,8001023 $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? 

 

Many thanks in advance.

 

Anthony 

1 ACCEPTED SOLUTION

Accepted Solutions
alau
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.

View solution in original post

4 REPLIES 4
Super User IV
Super User IV

Re: Calculate weekdays lapsed, but with a twist

First, Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490.

 

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...


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

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Highlighted
alau
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.

 

Thanks for your reply. Much apprecaited.   

Super User IV
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.


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

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

alau
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.

View solution in original post

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Top Solution Authors
Top Kudoed Authors