Forum Discussion

Pricey79's avatar
Pricey79
Helper V
5 years ago
Solved

Date Query

Hello

I have a problem that I cant solve.

I have a column in date form titled required date. I would like to know how I could get a card to show me how many items are due in the next two weeks, and how many items are required completely please?

Could anyone help?

Thank you 

  • Pricey79 . 

     

    You are not closing DISTINCTCOUNT. 

     

    Please use ) after giving the column. 

     

    Regards, 

    Manikumar

     

    If you think this is helpful Please Accept as Solution and leave a like

9 Replies

  • Pricey79 , Something like this

     

    Measure =
    var _min = maxx(allselcted('Table'),'Table'[Date])
    return
    calculate(count('Table'[Value]),filter('Table','Table'[Date] >=_min && 'Table'[Date] <= _min + 14))

     

    you can use distinctcount inplace of count

     

     

    Please provide your feedback comments and advice for new videos
    Tutorial Series Dax Vs SQL Direct Query PBI Tips
    Appreciate your Kudos.

     

     

    • Pricey79's avatar
      Pricey79
      Helper V

      amitchandak 

       

      Thank you for replying

       

      I'm afraid thats a bit complicated for me, I am a real novice at this. 

  • Pricey79 ,

    Use the below to check the last 14 days distinct values. 

     

    Measure =
    CALCULATE(DISTINCTCOUNT('Table'[Value]),DATESINPERIOD(LASDATE('Table'[Date]),-14,DAY))

    • Pricey79's avatar
      Pricey79
      Helper V

      manikumar34 

      Thank you for your reply. 

      Using your solution I get the error message :

       

      Too few arguments were passed in DATESINPERIOD fucntion. The minium argument count for the function is 4 

       

       

      • manikumar34's avatar
        manikumar34
        Solution Sage

        Pricey79 , hey Sorry. 

         

        I was missing to refre the Dates columns. 

         

        Measure =
        CALCULATE(DISTINCTCOUNT('Table'[Value]),DATESINPERIOD('Table'[Date],LASDATE('Table'[Date]),-14,DAY))

         

        Check with the above

         

        Reards, 

        Manikumar