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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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