Forum Discussion

YunJ's avatar
YunJ
Post Prodigy
6 years ago
Solved

How to write specific date column?

Hi,   I made a Date table as following.  When select a YearMonth such as 2020/05, the visual will show its YearWeeknum. However, I also want it show these YearWeeknum belongs to which date. ...
  • v-alq-msft's avatar
    6 years ago

    Hi, YunJ 

     

    I'd like to suggest you create a calculated column as below. The pbix file is attached in the end.

    DateDuration = 
    var _min = 
    CALCULATE(
        MIN('Date'[Date]),
        FILTER(
            ALL('Date'),
            'Date'[YearWeeknum]=EARLIER('Date'[YearWeeknum])&&
            'Date'[Month]=EARLIER('Date'[Month])
        )
    )
    var _max = 
    CALCULATE(
        MAX('Date'[Date]),
        FILTER(
            ALL('Date'),
            'Date'[YearWeeknum]=EARLIER('Date'[YearWeeknum])&&
            'Date'[Month]=EARLIER('Date'[Month])
        )
    )
    return
    _min&"-"&_max

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.