Forum Discussion
Anonymous
4 years agoNot applicable
Group data based on days difference
Hi Guys,
I have some data with date fields.
What I want to do is get the difference between these 2 days and group it under grouping table based on the number of days.
And the result should be how many orders are there for each group based on the number of days difference.
Answer should looks like this
Here is the file.
https://drive.google.com/file/d/1EY1GrBHieyd3XOpWvtWzGwiYqAmrkNfC/view?usp=sharing
- Please check this.
Delay Hours =var __minval =SELECTEDVALUE('Grouping'[Min])var __maxval =SELECTEDVALUE('Grouping'[Max])var __datatable =CALCULATETABLE('Data','Data'[Plan Vs Actual] = "Delayed")var __answer =CALCULATE(COUNT('Data'[Order Number]),FILTER('Data','Data'[Column1] >= __minval &&'Data'[Column1] <= __maxval),__datatable)return__answer
5 Replies
- AnonymousNot applicable
This is the code I am Trying
Delay Hours =var __minval =SELECTEDVALUE(Grouping[Min])var __maxval =SELECTEDVALUE(Grouping[Max])var __datediff =SELECTEDVALUE(Data[Column1])var __answer =CALCULATE(COUNT(Data[Order Number]),FILTER(Data,Data[Plan Vs Actual] = "Delayed"),FILTER(Data,COUNTROWS(FILTER(Grouping,__datediff>__minval &&__datediff< __maxval))))return__answer- KasunManchanayaRegular Visitor
Try this this should give the correct result.
Delay Hours =var __minval =SELECTEDVALUE('Grouping'[Min])var __maxval =SELECTEDVALUE('Grouping'[Max])var __datediff =SELECTEDVALUE('Data'[Column1])var __datatable =CALCULATETABLE('Data','Data'[Plan Vs Actual] = "Delayed")var __answer =CALCULATE(COUNT('Data'[Order Number]),FILTER('Data',__datediff > __minval &&__datediff < __maxval),__datatable)return__answer- AnonymousNot applicable
Not giving the expected Answer.