Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi all,
How i can use formula which help me make sameperiod last month with same count of working days in two periods.
Now i use this, but it's error (red text)
Hi @answeriver ,
Could you please share your sample data and expected result to me if you don't have any Confidential Information? Please upload your files to OneDrive for Business and share the link here.
@v-eachen-msft sorry but i can't share trought OneDrive.
Here is google link
https://drive.google.com/open?id=130o5zto6H26IB9vPb3pVNKO8n_iQGN8r
It's OK?
Actually data have information about clients, but i think is not necessary information
Hi @answeriver ,
According to your sample data, I found it always returns "22". It seems that you returned max working days from the whole table. You could use a filter to replace DATESMTD().
FILTER (
REPORT_IMS,
REPORT_IMS[VISIT YEAR] = YEAR ( TODAY () )
&& REPORT_IMS[VISIT MONTH] = MONTH ( TODAY () )
)
Because the period which i shared to you has 22 working days. If i take more date, so it will about 19-22 in some month.
But i dont understand measure above, there is not relationship with working days?
Hi @answeriver ,
I found that your DAX may missed a ")" behind MAX() function. It should be:
CALCULATE(MAX(REPORT_IMS[WORKING DAY] ) ;DATESMTD(REPORT_IMS[VISIT DATE]))
You could check if it works.
Hello @v-eachen-msft you right, but the problem is "A function CALCULATE has been used in a True/False expression ... This is not allowed"
Hi @answeriver ,
According to this error message, you could add a filter contains the True/False formula. Here is the DAX for your reference.
SPLM =
CALCULATE (
[mln st];
FILTER (
'REPORT_IMS';
'REPORT_IMS'[VISIT YEAR] = YEAR ( TODAY () )
&& 'REPORT_IMS'[VISIT MONTH]
= MONTH ( TODAY () ) - 1
&& REPORT_IMS[WORKING DAY]
<= CALCULATE (
MAX ( REPORT_IMS[WORKING DAY] );
DATESMTD ( REPORT_IMS[VISIT DATE] )
)
)
)
Sample data would help. 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
But, see these two as perhaps they will point you in the right direction:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/td-p/367362
Create a Total working day in your date table and use that
Assume you have working day =1 for the working day
Total working day = sumx(filter(Date,Date[Month]= earlier(Date[Month])),[working day ])
Now use this in you measure
Measure =
var _max = Maxx(allselected(Date),[Total working day]) // for the selected month
Hi,
Total working day = sumx(filter(Date,Date[Month]= earlier(Date[Month])),[working day ])
When i enter this fromula i can choose column in this step (red)
@answeriver , please find a new solution
Have columns like
Work Date = if(WEEKDAY([Date],2)>=6,BLANK(),[Date])
Work Day This month = if('Date'[Work Day]=1,sumx(filter('Date',[Month Year]=EARLIER('Date'[Month Year]) && [Date]<=EARLIER('Date'[Date]) ),[Work Day]),BLANK())
now you can have measure like
MTD Working Day=
var _max = maxx(allselected('Date'),[Work Day This month])
return
calculate(Sum('order'[Qty]),DATESMTD('Date'[Date]),'Date'[Work Day This month]<=_max)
LMTD Working Day=
var _max = maxx(allselected('Date'),[Work Day This month])
return
CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,month)),'Date'[Work Day This month]<=_max)
or
LMTD Working Day=
var _max = maxx(allselected('Date'),[Work Day This month])
return
CALCULATE(Sum('order'[Qty]),previousmonth('Date'[Date]),'Date'[Work Day This month]<=_max)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
72 | |
68 | |
41 | |
35 |
User | Count |
---|---|
109 | |
56 | |
52 | |
48 | |
42 |