Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Calculated column using IF function to display a message

Hi,

I need to create a calculated column to show if below statement is true it should write "Created" else "not created".The condition is

Account[Createdon]>=MIN(DateTable[Date]) &&
Account[Createdon]<=MAX(DateTable[Date])
 
Can anyone help me with this?
 
Thanks,
Mishelle
  • Hi Anonymous ,

     

    Sorry for that Power BI doesn’t support to tick or untick a measure in filter pane. The real column has the basic filtering.

     

     

    if you want to tick or untick the field, you need to change the measure to column.

    But the column will not dynamically change according to the slicer like the measure.

     

    If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data or describe the fields of each tables and the relations between tables simply?

    It will be helpful if you can show us the exact expected result based on the tables.

     

    Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

     

    Best regards,

     

    Community Support Team _ zhenbw

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

6 Replies

  • Anonymous , all the dates will be there on date table so it will always be created. If that is new column in Account table.

     

    The information you have provided is not making the problem clear to me. Can you please explain with an example.

    Appreciate your Kudos.

  • Anonymous 

    please try this

    Column = if(Account[createdon]>=min('DateTable'[date])&&Account[createdon]<=max('DateTable'[date]),"Created","Not Created")

     

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

    Hi Anonymous ,

     

    If you just want to create a status column that contains “Created” and “Not Created”, ryan_mayu 's answer is good.

    If you want to create a slicer based on Date table to control the status, we suggest to create a measure like this,

     

    Measure = 
    var _min = MIN(DateTable[Date])
    var _max = MAX(DateTable[Date])
    return
    IF(
        MAX(Account[Createdon])>=_min && MAX(Account[Createdon])<=_max,"Created","Not Created")

     

     

     

    If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data or describe the fields of each tables and the relations between tables simply?

     

    It will be helpful if you can show us the exact expected result based on the tables.

    Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

     

    Best regards,

     

    Community Support Team _ zhenbw

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

     

    BTW, pbix as attached.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi v-zhenbw-msft 

      Thanks for the explanations and based on your measure i created a similar measure and i need to use this measure in the filter pane as a filter.So user should be able to tick this measure if they need and untick.My measure is 

      Measure 2 =
      VAR minDate = CALCULATE(MIN(DateTable[Date]))
      VAR maxDate = CALCULATE(MAX(DateTable[Date]))
      RETURN IF(MAX(DateTable[Date])>=minDate && MAX(DateTable[Date])<= maxDate,
      minDate&", "&maxDate)
      But i cannot make this as a filter in the filter pane.Is this possible to do?
       
      Thanks
      Mishelle
      • v-zhenbw-msft's avatar
        v-zhenbw-msft
        Community Support

        Hi Anonymous ,

         

        Sorry for that Power BI doesn’t support to tick or untick a measure in filter pane. The real column has the basic filtering.

         

         

        if you want to tick or untick the field, you need to change the measure to column.

        But the column will not dynamically change according to the slicer like the measure.

         

        If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data or describe the fields of each tables and the relations between tables simply?

        It will be helpful if you can show us the exact expected result based on the tables.

         

        Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

         

        Best regards,

         

        Community Support Team _ zhenbw

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