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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Tybaal
Helper II
Helper II

Haga que un valor sea negativo dependiendo de un parámetro de otra tabla

Hola a todos,

Me gustaría valorar de mi tabla de hechos negativo si un campo de una tabla de dimensiones tiene un valor determinado.

Por ejemplo:

If ('Tipo de dimensión'[Tipo] á "A", SUM('Fact sales'[Amount] * -1, IF('Dimension Type'[Type] á "B", SUM('Fact sales'[Amount]))

Ambas tablas están vinculadas, por supuesto.

¿Puedes decirme cómo puedo hacer eso?

Gracias de antemano.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Tybaal, algo así

if (max('Dimension Type'[Type]) á "A", SUM('Fact sales'[Amount]) * -1, IF('Dimension Type'[Type] á "B", SUM('Fact sales'[Amount])))

O

sumx(values('Dimension Type'[Type]) ,if ('Dimension Type'[Type] á "A", SUM('Fact sales'[Amount]) * -1, IF('Dimension Type'[Type] á "B", SUM('Fact sales'[Amount]))))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Tybaal, algo así

if (max('Dimension Type'[Type]) á "A", SUM('Fact sales'[Amount]) * -1, IF('Dimension Type'[Type] á "B", SUM('Fact sales'[Amount])))

O

sumx(values('Dimension Type'[Type]) ,if ('Dimension Type'[Type] á "A", SUM('Fact sales'[Amount]) * -1, IF('Dimension Type'[Type] á "B", SUM('Fact sales'[Amount]))))

Gracias @amitchandak, funciona con su primera propuesta:

if (max('Dimension Type'[Type]) á "A", SUM('Fact sales'[Amount]) * -1, IF(max('Dimension Type'[Type] á "B", SUM('Fact sales'[Amount])))

Pero, ¿puede explicar por qué no funcionó sin el 'max'? (Lo siento, soy un principiante en DAX)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.