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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
renanpinheiro
Advocate II
Advocate II

Cálculo de Régua

Hi guys,
I need to create a calculated column in the table below:

 

tabela.png

I have the "Cupons" and "Quantidade" columns. The "Items por Cupom" column is the division from the first to the second.
I need now to create a column in which I have the maximum value of the "Items por Cupom" column of each cluster (first column). In the image, it would be 0.65 for cluster 2, 0.61 for cluster 3, and so on. The values must be repeated row by row for each cluster.

 

Can someone help me?

1 ACCEPTED SOLUTION

Hi @renanpinheiro,

 

Based on my test, the formula below should work in this scenario. Smiley Happy

Max of Items por Cupom =
CALCULATE (
    MAXX (
        SUMMARIZE (
            'BD_LACUNA',
            'BD_LACUNA'[Cluster],
            'BD_LACUNA'[NOME_LOJA],
            "Cluster_NOME_LOJA_Items", [Items por Cupom]
        ),
        [Cluster_NOME_LOJA_Items]
    ),
    ALLEXCEPT ( 'BD_LACUNA', 'BD_LACUNA'[Cluster] )
)

 

Regards

View solution in original post

3 REPLIES 3
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @renanpinheiro,

 

Could you try the formula below to see if it works in your scenario? Smiley Happy

Max of Items por Cupom =
CALCULATE (
    MAX ( 'BD_LACUNA[Items por Cupom]' ),
    ALLEXCEPT ( 'BD_LACUNA', 'BD_LACUNA'[Cluster] )
)

 

Regards

Hi @v-ljerr-msft,

The "Items por Cupom" column is a measure and the MAX function does not allow you to use measures, how can I get around this?

Hi @renanpinheiro,

 

Based on my test, the formula below should work in this scenario. Smiley Happy

Max of Items por Cupom =
CALCULATE (
    MAXX (
        SUMMARIZE (
            'BD_LACUNA',
            'BD_LACUNA'[Cluster],
            'BD_LACUNA'[NOME_LOJA],
            "Cluster_NOME_LOJA_Items", [Items por Cupom]
        ),
        [Cluster_NOME_LOJA_Items]
    ),
    ALLEXCEPT ( 'BD_LACUNA', 'BD_LACUNA'[Cluster] )
)

 

Regards

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.