Forum Discussion

OvaisJanzeb's avatar
OvaisJanzeb
Frequent Visitor
4 years ago

How to convent Column into Measure DAX

Hello,

I want to convent this code into measure but able to do it with replace of fix number with selected value,
Please can anyone help me out?

Months in excel = 
IF(OR(ServiceModel[Month].[Year] = 2021 && ServiceModel[Month].[MonthNo] = 12,OR(ServiceModel[Month].[Year] = 2021 && ServiceModel[Month].[MonthNo] = 11, OR(ServiceModel[Month].[Year] = 2021 && ServiceModel[Month].[MonthNo] = 10, ServiceModel[Month].[Year] = 2021 && ServiceModel[Month].[MonthNo] = 9))), "Y", "N")

2 Replies

  • OvaisJanzeb , Try new measure

     

    new measure =
    var _Date = max(ServiceMo[Month])
    return
    if( _date >= Date(2021,09,01) && _date <= DAte(2021,12,21), "Y", "N")

  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    Icon for Community Support rankCommunity Support

    Hi OvaisJanzeb ,

     

    Try this:

    Months in excel =
    IF (
        SELECTEDVALUE ( ServiceModel[Month] ) >= DATE ( 2021, 9, 1 )
            && SELECTEDVALUE ( ServiceModel[Month] ) <= DATE ( 2021, 12, 31 ),
        "Y",
        "N"
    )
    

     

    You can refer this function: SELECTEDVALUE function - DAX | Microsoft Docs

     

    Best Regards

    Community Support Team _ chenwu zhu

     

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