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
Syndicate_Admin
Administrator
Administrator

How to make conditions about what appears in the visual power bi table

Hello, I have loaded in a table (visual element within power bi canvas) a list of the 8 provinces of Andalusia, and I need to apply a calculation depending on the city that appears, for example if the city is Malaga I need to divide number of sales by amount sold and multiply it by a certain percentage (let's say that for Malaga it is (3%). But if it appears in the Cadiz table I need you to do the same by multiplying it by 4%.

I tried to use the function as follows... if(MAX('Mu Papel Id Caras ADHOC'[City] = "MALAGA"), (nunSales/sales)*3% but indicates the following error "the Max function only accepts a column reference as an argument"

Greetings and thanks in advance

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Syndicate_Admin ,

 

For the created measure, an aggregate value needs to be nested in the field, indicating the current row. The reference is as follows.

Product =
SWITCH (
    TRUE (),
    MAX ( 'Table'[Ciudad] ) = "MALAGA",
        ( 400 / 5 ) * 0.03,
    BLANK ()
)

 

vhenrykmstf_0-1662108228878.png

 


If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


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

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @Syndicate_Admin ,

 

For the created measure, an aggregate value needs to be nested in the field, indicating the current row. The reference is as follows.

Product =
SWITCH (
    TRUE (),
    MAX ( 'Table'[Ciudad] ) = "MALAGA",
        ( 400 / 5 ) * 0.03,
    BLANK ()
)

 

vhenrykmstf_0-1662108228878.png

 


If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


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

Syndicate_Admin
Administrator
Administrator

I have tried to do a test and it had never happened to me, the table or the column does not recognize me and I have looked at the table and it is well written, do you know why this can happen?

I pass the screen print of both the measurement and the table with that column

JaviBI_0-1661808084651.png

JaviBI_1-1661808133540.png

claymcooper
Resolver II
Resolver II

I would try a switch statement:
SWITCH(
TRUE(),
Mu Papel Id Caras ADHOC'[City] = "MALAGA"(nunSales/sales)*3%,
Mu Papel Id Caras ADHOC'[City] = "City 2" , Calculation 2,
etc.

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.