Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to use the method below to limit the range of number in chart expression, but it can‘t limit the range of number successfully.
This is my test data:
I have find what is the problem, thank you all~
There are some blanks within the chart expression, so the correct one is as below:
count( {$<DATE_WORK={">=$(=date(max(DATE_WORK)-30))<=$(=max(DATE_WORK))"},WORK_STATE={'Y'}>} [Employee ID])/
count( {$<DATE_WORK={">=$(=date(max(DATE_WORK)-30))<=$(=max(DATE_WORK))"}>} [Employee ID])
The wrong one is as below:
count({$<DATE_WORK={">=$(=date(max(DATE_WORK)-30)) <= $(=max(DATE_WORK))"}, WORK_STATE={'Y'}>}[Employee ID]) /
count({$<DATE_WORK={">=$(=date(max(DATE_WORK)-30)) <= $(=max(DATE_WORK))"}>}[Employee ID])
If you are interested in the detail, you can compare two chart expression to find what is the exact problem~
BR!
Hello
Please find below working logic, attaching screenshot for reference
Logic: Count({$<A={">=3 <=4"}>} B)
Reason:
There is a ) inside the search string, which breaks the syntax
Screenshot:
If you find useful, Please mark this as Solution
Thanks
Thanks ysalvi43, that is make sense.
But what I want to build is using a more complex chart expression which is as below:
count({$<DATE_WORK={">=$(=date(max(DATE_WORK)-30)) <= $(=max(DATE_WORK))"}, WORK_STATE={'Y'}>}[Employee ID])
This chart expression has the same problem of the ending limitation of date is not successful,
so how can I modify it?
thanks again,
BR!
Hello @HelloHMC
Please test this formula:
count( {$<
DATE_WORK={">=$(=max(DATE_WORK)-30)<=$(=max(DATE_WORK))"},
WORK_STATE={'Y'}
>} [Employee ID])
Tested at my end working fine with raw data:
Thanks
Thank you,
but it doesn't work at all~
May be because there are two forms of date, and that is why I write the chart expression like previously!
count( {$<DATE_WORK={">=$(=max(DATE_WORK)-30)<=$(=max(DATE_WORK))"},WORK_STATE={'Y'}>} [Employee ID]) /
count( {$<DATE_WORK={">=$(=max(DATE_WORK)-30)<=$(=max(DATE_WORK))"}>} [Employee ID])
BR!
Hello
You can use floor for those date, it will convert date formatting to number
Thanks
Hi @HelloHMC
If the -30 means that you want to set the date for the previous month, I would recommend this formula:
count( {$<DATE_WORK={">=$(=addmonths(max(DATE_WORK),-1))<=$(=max(DATE_WORK))"},WORK_STATE={'Y'}>} [Employee ID]) /
count( {$<DATE_WORK={">=$(=addmonths(max(DATE_WORK),-1))<=$(=max(DATE_WORK))"}>} [Employee ID])
Kind Regards
Daniel
Hi,
For date searches with >= & <= you either have to format search string as date or create an equivalent field in numeric format.
I want to display the past 30 days data of the max date I have chosen.
So it is not just choose last month's date.
But also thank you.
Cheers~
Yes I get you.
But my original chart expression is as below:
count( {$<DATE_WORK={">=$(=date(max(DATE_WORK))-30)<=$(=max(DATE_WORK))"},WORK_STATE={'Y'}>} [Employee ID]) /
count( {$<DATE_WORK={">=$(=date(max(DATE_WORK)-30))<=$(=max(DATE_WORK))"}>} [Employee ID])
This chart expression has the same format of start and end date, however it is also not work.
So what is the problem of my chart expression and how can I adjust it?