Forum Discussion
DAX Comparison Operations do not support
- 5 years ago
Hi, Sharma0815
According to your description, I can understand clearly what you want to get, you want to get the percentage of the most recent month's positive feedbacks, right? I also created some data and used DAX to achieve this, you can try my steps:
This is my test data based on your picture:
- I created a calculated column:
datediff = DATEDIFF([record date],TODAY(),DAY)- I created a measure:
Percent = var _leastdatadiff= CALCULATE(MIN('Table'[datediff]),FILTER(ALL('Table'),[feedback]="Positive")) var _mostrecentmonth= MONTH(CALCULATE(MAX('Table'[record date]),FILTER(ALL('Table'),[datediff]=_leastdatadiff&&[feedback]="positive"))) var _mostrecentyear= YEAR(CALCULATE(MAX('Table'[record date]),FILTER(ALL('Table'),[datediff]=_leastdatadiff&&[feedback]="positive"))) var _countofpositive= COUNTX(FILTER(ALL('Table'),MONTH([record date])=_mostrecentmonth&&YEAR([record date])=_mostrecentyear&&[feedback]="positive"),[ID]) var _countofall= COUNTX(FILTER(ALL('Table'),MONTH([record date])=_mostrecentmonth&&YEAR([record date])=_mostrecentyear),[ID]) return DIVIDE(_countofpositive,_countofall)- I created a card chart and placed the measure:
And I think the result can be what you want.
You can download my test pbix file here
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result so that we can help you in advance.
How to Get Your Question Answered Quickly
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Sharma0815
According to your description, I can understand clearly what you want to get, you want to get the percentage of the most recent month's positive feedbacks, right? I also created some data and used DAX to achieve this, you can try my steps:
This is my test data based on your picture:
- I created a calculated column:
datediff =
DATEDIFF([record date],TODAY(),DAY)
- I created a measure:
Percent =
var _leastdatadiff=
CALCULATE(MIN('Table'[datediff]),FILTER(ALL('Table'),[feedback]="Positive"))
var _mostrecentmonth=
MONTH(CALCULATE(MAX('Table'[record date]),FILTER(ALL('Table'),[datediff]=_leastdatadiff&&[feedback]="positive")))
var _mostrecentyear=
YEAR(CALCULATE(MAX('Table'[record date]),FILTER(ALL('Table'),[datediff]=_leastdatadiff&&[feedback]="positive")))
var _countofpositive=
COUNTX(FILTER(ALL('Table'),MONTH([record date])=_mostrecentmonth&&YEAR([record date])=_mostrecentyear&&[feedback]="positive"),[ID])
var _countofall=
COUNTX(FILTER(ALL('Table'),MONTH([record date])=_mostrecentmonth&&YEAR([record date])=_mostrecentyear),[ID])
return
DIVIDE(_countofpositive,_countofall)
- I created a card chart and placed the measure:
And I think the result can be what you want.
You can download my test pbix file here
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result so that we can help you in advance.
How to Get Your Question Answered Quickly
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.