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
fernandilus
Frequent Visitor

Measure problem

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"

 

fernandilus_1-1723469981543.png

fernandilus_3-1723470021505.pngfernandilus_4-1723470039892.png

 

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

fernandilus_5-1723471303269.png

all databases are linked by a column called CLAVE

fernandilus_6-1723471375776.png

and even when I just try just using a measure just to test

fernandilus_8-1723471491893.png

this happens...

fernandilus_9-1723471523960.png

 

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!!

 

 

 

2 REPLIES 2
fernandilus
Frequent Visitor

Hello!

thank you for taking the time for this!

Let me explain with a bit more detail. I believe I failed to explain correctly.

fernandilus_8-1723639870112.png

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)

 

fernandilus_0-1723638754260.png

 

Then, I have my STOCK column, which comes from the STOCK database, originally is "Libre utilización" but it was renamed in this visualization.

 

fernandilus_3-1723638976942.png

And finally, STOCK MÍNIMO, which comes from the database PARÁMETROS

 

fernandilus_2-1723638950068.png

 

So, I tried your measure, but I got the same error. Then I tried using my previous measure, but I am still getting errors

 

fernandilus_9-1723640078299.png

 

fernandilus_6-1723639764925.png

 

I tried creating the measure in different databases, but the outcome was the same

thank you again for taking the time to help me!

Anonymous
Not applicable

Hi @fernandilus ,

I create sample data myself:

vjunyantmsft_2-1723514319902.png
vjunyantmsft_1-1723514310363.png

vjunyantmsft_3-1723514334675.png

First of all I'm a bit confused as to why your two measures are not reporting errors:

vjunyantmsft_4-1723514407484.png

vjunyantmsft_5-1723514414123.png

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:

vjunyantmsft_6-1723514608821.png


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.

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors