Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Creating a flag

Hi everyone, I have a database here show me all the shop information about my clients and i need to do a flag in power bi that show me if the client in some point of the life put some credit in th...
  • v-alq-msft's avatar
    6 years ago

    Hi, Anonymous 

     

    You may create a calculated table and a measure as below.

    Calculated table:

    Calendar = CALENDARAUTO()

     

    Measure:

    Result = 
    Var _month = SELECTEDVALUE('Calendar'[Date].[MonthNo])
    Var _year = SELECTEDVALUE('Calendar'[Date].[Ano])
    
    Return
    IF(
        COUNTROWS(
            FILTER(
                ALL('relatorio_cartoes (74) - Copia'),
                YEAR('relatorio_cartoes (74) - Copia'[Order])=_year&&
                MONTH('relatorio_cartoes (74) - Copia'[Order])=_month&&
                'relatorio_cartoes (74) - Copia'[User]=SELECTEDVALUE('relatorio_cartoes (74) - Copia'[User])
            )
        )>0,
        "Y","N"
    )

     

    Then you may use the 'Date' column from 'Calendar' to filter the 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.