week-number

PowerBi - Current Week


I have a Multi-row card where it shows how many CLL, PLL, and KG our warehouse have packed "today".

However I would like to have similar card which sums up the current week. (Meant as a fun fact for our warehouse) But i'm struggling with making a filter from where it only shows the current week.

The filter I made to get "today" is pretty basic (not pretty, but it works)

Gettoday = IF('Date'[Date]=TODAY(),"Yes","No")

I have tried making similar with week instead but it don't seem to work.

Anyone have any suggestions?

Thanks


Solution

  • what you can do, to fit your approach (assuming you're using a calculated column here) would be something like:

    get_current_week = IF(
        AND(
        WEEKNUM(TODAY()) = WEEKNUM('Date'[Date]),
        YEAR(TODAY()) = YEAR('Date'[Date])
        ),
        "Yes",
        "No"
    )
    
    

    basically you compare year & weeknum of today, to your date value's: https://learn.microsoft.com/en-us/dax/weeknum-function-dax

    i would recommend, that you check out the microsoft reference on datefunctions because there's bound to be a more elegant way to setting that filter.