Forum Discussion

ThomasBP's avatar
ThomasBP
Frequent Visitor
7 years ago

problem_New_year_calculs_refresh

Hello, 

 

 

I was wondering, in one of my calcul for the current week I put: Semaine_en_cours = WEEKNUM(TODAY())

So since 2018, I have all the current weeks auto calculated. 

 

For today, the formula includes the 31/12/2018 as the "53rd" week . But 2018 ends at the "52" (see bellow)
So How may I get my " Semaine en cours : 1 " on the board ? 

 

 

 

 

 

Any solutions /advice / tips ? 

Thanks by advance,

 

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Well, the issue is that there really are 53 weeks in 2018. But, if it bugs you, you can always do this:

     

    Semaine_en_cours = 
    VAR __weeknum1 = WEEKNUM(TODAY())
    RETURN
    IF(__weeknum1 > 52,52,__weeknum1) 
  • v-juanli-msft's avatar
    v-juanli-msft
    Community Support

    Hi ThomasBP

    if you want the slicer to change as you said, 

    please create calculated columns in your date table

    slicer-weeknum = IF([calendar_weeknum]>52,1,[calendar_weeknum])
    slicer-year = IF([calendar_weeknum]>52,[calendar_year]+1,[calendar_year])
    

     

     

     

    Best regards

    Maggie

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

    Hi ThomasBP

    try this measure instead of your formula

    you could replace "DATE( )" with today( )

    Measure 2 = var week1=WEEKNUM(DATE(2018,12,31),2) return IF(week1>52,1,week1)

     

    Best Regards

    Maggie

  • themistoklis's avatar
    themistoklis
    Community Champion

    ThomasBP

     

    Also there is another parameter for the weeknum function where you specify whether a week starts on Sunday or on Monday.