Forum Discussion

DeEviloN's avatar
DeEviloN
Helper III
4 years ago
Solved

Pwer Bi Last Date

Помоги мне, пожалуйста. У меня есть условия, которые определяют рейтинг, при котором с текущей датой, которую я выбрал, он выполняет поиск последних 4 дат, когда этот пользователь был замечен, и определяет его рейтинг на основе допущенных им ошибок.
1. Если в течение последних 4 дней подряд у него были ошибки, то все плохо (красный)
2. Если за последние 4 дня у него было не более 4 ошибок, то все в порядке (оранжевый)
3. Если были за последние 4 дня ошибок нет, значит все нормально (синий). Как это сделать в Power Bi?

Теперь у меня так:

 

  • DeEviloN , You use date table time intelligence to get count last 4 days use error count measure in place of measure

     

    Rolling 4 = CALCULATE([Measure],DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-4,Day))

     

    then you can use switch/if for test of the logic

6 Replies

  • Help me please. I have conditions that determine the rank, at which, from the current date that I have chosen, it searches for the last 4 dates where this user was spotted and determines his rank based on the mistakes he made.
    1. If during the last 4 days in a row he has mistakes, then everything is bad (red)
    2. If during the last 4 days he has no more than 4 errors, then everything is fine (orange)
    3. If there are no errors during the last 4 days, then everything is fine (blue). How to do it in Power Bi?

    • amitchandak's avatar
      amitchandak
      Super User

      DeEviloN , You use date table time intelligence to get count last 4 days use error count measure in place of measure

       

      Rolling 4 = CALCULATE([Measure],DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-4,Day))

       

      then you can use switch/if for test of the logic

      • DeEviloN's avatar
        DeEviloN
        Helper III


        Will he count exactly 4 days before? For example, he appeared on 1.10, 5.10, 9.10 and then appeared on 10/25/11, will he count 4 days from that date? 25.24.23.22? Or 25, 9, 5, 1? These days will search and compare, are there any mistakes or not?

  • I need to count exactly his last days when he came, and not from the last day - 4 days ago, because, as shown in the table, he does not come regularly, but several times within a month and it is from the date of his appearance that the last 4 days should be counted his appearance