Forum Discussion

Sharma0815's avatar
Sharma0815
Helper II
5 years ago
Solved

DAX Comparison Operations do not support

I am trying to create a measure to calculate the percentage of the most recent month's positive feedbacks from my dataset and to get that I'm using the below measure.           Pre Month Survey...
  • v-robertq-msft's avatar
    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:

     

    1. I created a calculated column:
    datediff =
    
    DATEDIFF([record date],TODAY(),DAY)
    1. 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)
    1. 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.