Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
msam86
Helper I
Helper I

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 when I select the YEAR. Is this possible? 

 

Ex.1:

msam86_0-1717788630100.png

ex.2:

msam86_1-1717788655412.png

 

Regards!

 

 

 

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

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:

vyangliumsft_0-1718001259536.png

Here are the steps you can follow:

1. Enter data – create a table.

vyangliumsft_1-1718001259539.png

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"
)

vyangliumsft_2-1718001293437.png

 

 

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

View solution in original post

5 REPLIES 5
v-yangliu-msft
Community Support
Community Support

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:

vyangliumsft_0-1718001259536.png

Here are the steps you can follow:

1. Enter data – create a table.

vyangliumsft_1-1718001259539.png

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"
)

vyangliumsft_2-1718001293437.png

 

 

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

Thank you my friend. I understood what you did and applied it to my table.

Regards

msam86
Helper I
Helper I

Hi guys,

 

I created a pbix file to help understand what I need.

 

I need to count how many times the measurement words appear and are shown in a pie chart.

 

Regards

 

Download pbix:

https://acesse.dev/c4VJ7

Kaviraj11
Super User
Super User

Yes, It's possible. Drop in the Pie Chart, Put the measure created into 'Values' section & Column that contains Attention or complianc into the legend section. You will have the ability to select the label contents under Details Labels section too. 

 

Kaviraj11_0-1717789172382.png

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @Kaviraj11 , but there is one point that I forgot to mention: I created this measurement using a parameter:

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",
    MAX(Dados[MesclaANO])  -- Default to the original status if no condition matches
)


I need this condition year after year to visualize the pie chart.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.