The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have loaded in a table (visual element within the canvas of power bi) a list of cities, and I need to apply a calculation depending on the city that appears, for example if the city is Malaga I need to apply to an amount a little percent (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"), (nunVentas/ventas)*3% but indicates the following error "the Max function only accepts a column reference as an argument"
So I have chosen to make a Switch and evaluate the cities but I do not recognize the table or the column to which I refer (this has never happened to me the truth) and I have looked at the table and it is well written
If for example I call the table and column with the sum function links without problems but with the example that I put below there is no way to reference it
Maybe it's silly, but do you know why this can happen?
I pass you screen print of the measure with the error that gives me and the table with that column
Greetings and thanks
Solved! Go to Solution.
Hi, @Syndicate_Admin ;
Here (where the red label is) there is one less right parenthesis so the measure is incorrect.
Or
Prueba =
IF (
MAX ( 'Mu Papel ID Caras'[Ciudad] ) = "MALAGA",
400 / 5 * 0.03,
IF ( MAX ( 'Mu Papel ID Caras'[Ciudad] ) = "CADIZ", 400 / 5 * 0.04 )
)
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Syndicate_Admin ;
Here (where the red label is) there is one less right parenthesis so the measure is incorrect.
Or
Prueba =
IF (
MAX ( 'Mu Papel ID Caras'[Ciudad] ) = "MALAGA",
400 / 5 * 0.03,
IF ( MAX ( 'Mu Papel ID Caras'[Ciudad] ) = "CADIZ", 400 / 5 * 0.04 )
)
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Try:
Prueba =
SWITCH (
MAX ( 'Mu Papel ID Caras'[Ciudad] ),
"MALAGA", DIVIDE ( 400, 5 ) * 0.03,
"CADIZ", DIVIDE ( 400, 5 ) * 0.04
)
You can of course change the DIVIDE expressión to include the pertinent measures:
DIVIDE ( [Measure 1], [Measure 2])
Proud to be a Super User!
Paul on Linkedin.
@Syndicate_Admin , A measure can not use not summarized columns .
Put your code inside sumx or maxx
Sumx('Mu Paper ID Caras ADHOC',
<Your Sitch Code>
)