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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
gelsonwirtijr
Frequent Visitor

how to plot classification data made using a dax measure

Hello, I have the measure:

Classificação Cliente Peças =
VAR TotalServicos = [Realizado]
RETURN
    SWITCH(
        TRUE(),
        TotalServicos >= 1000000, "K",
        TotalServicos >= 300000 && TotalServicos < 1000000, "A",
        TotalServicos >= 50000 && TotalServicos < 300000, "B",
        TotalServicos < 50000, "C",
        BLANK()
    )

which classifies my customers based on how much they spent. I would like to plot it in a bar graph, that is, the X axis should be the classes "K", "A", "B" and "C" and the Y axis the quantity of each class. I tried to do it by creating a table as follows:

ClassificaçãoPeças =
SUMMARIZE(
    dClientes,
    dClientes[Cliente],
    "Classificação Peças", [Classificação Cliente Peças]
)
gelsonwirtijr_0-1694441961332.png

That's the idea, but I can't filter by date, as it's not possible to make any relationship. Is there any way I can plot this graph but it reacts to the year filter?

Below is the measure [Realizado], used in the classification:

Realizado = CALCULATE([FY Fat.])

FY Fat. = var vFY =[FY Seleção]
RETURN CALCULATE([Total Fat.], FILTER('dCalendário', 'dCalendário'[Ano FY]=vFY))

FY Seleção = var vFY = IF(MONTH([Data Seleção])=11|| MONTH([Data Seleção])=12, YEAR([Data Seleção])+1, YEAR([Data Seleção]))
RETURN INT(FORMAT(vFY,"####"))
Total Fat. =
CALCULATE(SUM(fFaturamento[Valor Bruto]), fFaturamento[Setor]="Balcão")+0


1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @gelsonwirtijr 

You can try to create a new table, then put the type to the new table

e.g 

Type={"A","B","C","K"}

Then create a new measure

e.g

Counts =
CALCULATE (
    COUNTROWS ( dClientes ),
    FILTER ( dClientes, [Classificação Cliente Peças] IN VALUES ( 'Type'[Value] ) )
)

Then put the Counts measure to the y-axis, then it can be affected by the date filter.

 

Best Regards!

Yolo Zhu

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

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

It is a typical dynamic segmentation problem.  Please see the attached file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @gelsonwirtijr 

You can try to create a new table, then put the type to the new table

e.g 

Type={"A","B","C","K"}

Then create a new measure

e.g

Counts =
CALCULATE (
    COUNTROWS ( dClientes ),
    FILTER ( dClientes, [Classificação Cliente Peças] IN VALUES ( 'Type'[Value] ) )
)

Then put the Counts measure to the y-axis, then it can be affected by the date filter.

 

Best Regards!

Yolo Zhu

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.