Forum Discussion

msam86's avatar
msam86
Helper I
2 years ago
Solved

Pie chart with measure

Hi friends,   In another topic I had help creating a measure. Now I'm trying to create a pie chart to see the consolidated information. I want to know how many times Attention or compliance appears...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Thanks for the reply from Kaviraj11 , please allow me to provide another insight: 

    Hi  msam86 ,

     

    I couldn't open your PBIX on my end, so I created the data:

    Here are the steps you can follow:

    1. Enter data – create a table.

    2. Create measure.

    Measure=
    COUNTX(
        FILTER(ALL('Dados'),[Status]=MAX('Table'[Status])),[Status])

    3. Result:

    Note: You need to change [Status], delete the formula “MAX(Dados[MesclaANO]) -- Default to the original status if no condition matches”, or replace it with the same formula as before. data type (this formula data type is text)/blank () instead of

    According to Power BI design, there can only be one data format in a column of data, and “Compliance” is a text type, MAX(Dados[MesclaANO]) is a date type.

    Status =
    VAR SelectedYear = SELECTEDVALUE('DataParameter'[DataParameter])
    RETURN
    SWITCH(
        TRUE(),
        YEAR(MAX(Dados[MesclaANO])) < SelectedYear, "Down",
        YEAR(MAX(Dados[MesclaANO])) = SelectedYear, "Attention",
        YEAR(MAX(Dados[MesclaANO])) > SelectedYear, "Compliance"
    )

     

     

    Best Regards,

    Liu Yang

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