Forum Discussion

ToNo87's avatar
ToNo87
Regular Visitor
9 years ago
Solved

Get value from a field based on another field

I have a table something like this

 

Value | Datetime (date)

2          12/12/2016

3          12/12/2016

2          12/12/2016

2          12/12/2016

4          12/12/2016

2          12/14/2016

 

What I want to do is to create a measure where I get a distinct count of the "value" datafield, based on the "Date" column where the date column is NOW - 1 month.

 

How do I acheive this? 

  • Hi ToNo87

     

    create measure like

    Distinctcount M-1 = CALCULATE(DISTINCTCOUNT(Table1[Value]);DATEADD(Table1[Date];-1;MONTH))

     

    Regrds.

    Pavel

6 Replies

  • PavelR's avatar
    PavelR
    Icon for Solution Specialist rankSolution Specialist

    Hi ToNo87

     

    create measure like

    Distinctcount M-1 = CALCULATE(DISTINCTCOUNT(Table1[Value]);DATEADD(Table1[Date];-1;MONTH))

     

    Regrds.

    Pavel

    • ToNo87's avatar
      ToNo87
      Regular Visitor

      I'm getting a warning that says "The syntax for ';' is incorrect. " (I am using Power BI Desktop). :) 

      • PavelR's avatar
        PavelR
        Icon for Solution Specialist rankSolution Specialist

        It works fine. Maybe that when you have edited the formula you have also removed some bracket or something.

         

        Regards.

        Pavel