Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Continuous Formula

Hi,

 

Is there a formula I can use that can be a continuous if then statement without having to write it all out?

 

So far this is my formula for Jan 1,2014:

 

if(Query1[date opened]="01/01/2014",1,0)
 
Is there a way to say:
 
if(Query1[date opened]="01/01/2014",1,if(Query1[date opened]="01/02/2014",2, if(Query1[date opened]="01/03/2014",3,...)
 
but to have it condensed?
I am trying to do this because I need to label all dates from 2014 to present, and it would be helpful if there was a quick way to do this...
 
Thank you!
Sarah

6 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Greg_Deckler  this is great! but how do i show it over the years? so 1/1/2014 would be 1, but 1/1/2015 would be 366, 1/1/2016 would be 732 (bc of leap year)

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Right, that was the purpose of Sequential, to give a sequential number that spanned years. I think I did it based on weeks and not days but should be relatively easy to modify for days. You may have to scroll through the entire thread because I think there were some bug fixes. I have the official version in my book which I believe had all of the bug fixes and other improvements that I came up with. Let me know if you need some help modifying it. I can probably find some time to go grab my latest code from my book and modify it for day instead of week.

  • v-lili6-msft's avatar
    v-lili6-msft
    Community Support

    hi  Anonymous 

    The simple way is use RANKX Function to create a calculate column

    Column=RANKX('Date',[Date],,ASC)

     

     

    and here is sample pbix file, please try it.

     

    Regards,

    Lin

    • Anonymous's avatar
      Anonymous
      Not applicable

      thank you so so much!
      Sarah