Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello
I am having some issues with a measure and I can't figure out what I am doing wrong.
I have a card with several rows that is connected to 3 databases and also 2 measure.
INGRESO and CONSUMO since are born from the same column, both are measures from database "CONSUMOS"
STOCK is a column from the database "STOCK"
STOCK MÍNIMO is a column from the database "PARÁMETROS"
Up to this point, it is all working, but I need a fifth number shown, which is my calculation for a next purchase. The logic is the following
NEW_PURCHASE= IF(CONSUMO*1.15 - STOCK < STOCK MINIMO, STOCK MINIMO, CONSUMO*1.15 - STOCK)
where I am buying what was consumed plus a 15% of it, minus the current stock. If this result is lower than the minimun stock, I must still buy the amount set in "STOCK MÍNIMO", otherwise, I will buy the first calculation.
BUT, I can't create this measure... I can't access the PARAMETROS database
all databases are linked by a column called CLAVE
and even when I just try just using a measure just to test
this happens...
I lose all the info that was shown.
I really have no idea of what I am doing wrong, could you please help me??
Thank you in advance!!
Hello!
thank you for taking the time for this!
Let me explain with a bit more detail. I believe I failed to explain correctly.
My two measures come from the same column (column "Ctd. en UM entrada", in the database CONSUMOS)
INGRESOS = CALCULATE(SUM(CONSUMOS[Ctd.en UM entrada]),CONSUMOS[Clase de movimiento]=101)CONSUMO = CALCULATE(SUM(CONSUMOS[Ctd.en UM entrada])*-1,CONSUMOS[Clase de movimiento]=201)
Then, I have my STOCK column, which comes from the STOCK database, originally is "Libre utilización" but it was renamed in this visualization.
And finally, STOCK MÍNIMO, which comes from the database PARÁMETROS
So, I tried your measure, but I got the same error. Then I tried using my previous measure, but I am still getting errors
I tried creating the measure in different databases, but the outcome was the same
thank you again for taking the time to help me!
Hi @fernandilus ,
I create sample data myself:
First of all I'm a bit confused as to why your two measures are not reporting errors:
You mentioned that STOCK is a column in the table STOCK, but you are not allowed to navigate directly to other table columns without using any functions (e.g. max, min, related, etc.) in DAX. Unless your STOCK is a measure then it will work, but this contradicts the information you provided earlier.
Here is the measure I create:
NEW_PURCHASE =
IF(
'CONSUMOS'[CONSUMO] * 1.15 - MAX('STOCK'[STOCK]) < MAX('PARÁMETROS'[STOCK MÍNIMO]),
MAX('PARÁMETROS'[STOCK MÍNIMO]),
'CONSUMOS'[CONSUMO] * 1.15 - MAX('STOCK'[STOCK])
)
And the final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!