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
ramshoney1225
Helper V
Helper V

Necesidad de escribir un cálculo basado en dos tablas con una condición

Hola

Necesito crear una medida DAX basada en una condición

Tengo dos tablas HData, Contractdata donde necesito calcuate count(UniqueID) basado en una condición (> ) con dos tablas diferentes.

Cómo escribir las siguientes condiciones con dos tablas diferentes

CALCULATE(count(Hdata[uniqeID]),
FILTRO(Hdata,Hdata[Duración]) >
(FILTER('Contractdata','Tipo de contrato'[SERVICE_LEVEL_TARGET])))
¿Cómo escribir el anterior?, estoy recibiendo un error.
Gracias
Carneros
1 ACCEPTED SOLUTION

Hola @ramshoney1225 ,

Puede crear una medida como se indica a continuación:

COUNTID = 
CALCULATE (
    COUNT ( 'TABLEA'[UniqueID] ),
    FILTER (
        'TABLEA',
        'TABLEA'[Duration]
            > CALCULATE (
                SUM ( 'TABLEB'[Duration] ),
                FILTER ( 'TABLEB', 'TABLEB'[Id] = EARLIER ( 'TABLEA'[UniqueID] ) )
            )
    )
)

COUNTID.JPG

Saludos

Rena

Community Support Team _ Rena
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

4 REPLIES 4
amitchandak
Super User
Super User

@ramshoney1225 ,

No parece correcto. Puede compartir datos de ejemplo y salida de muestra.

Hola por favor encuentre la siguiente captura de pantalla para la necesidad.

necesito crear una medida como abajo ;;

Número de id únicos ?

calcular(

count(tablea[uniqueid),

filter( tablea(duration) > tableb(duration)

)

No puedo escribir el DAX , soy consciente de wirting de DAX con si dos columnas disponibles en la misma tabla entonces podemos escribir como abajo

COUNTID ?

Calcular

(COUNT(TABLEA[UNIQUEID],

FILTRO(TABLEA, TABLEA[DURATION1] > TABLEA[DURATION2]

)

pero en mi caso la condción que i ned para escribir cada colum está disponible en la tabla diferente y la necesidad de escribir como

Basado en esta condción tablea(duration) > tableb(duration) i need to calculate count in one table.

ISSUE.png

Hola @ramshoney1225 ,

Puede crear una medida como se indica a continuación:

COUNTID = 
CALCULATE (
    COUNT ( 'TABLEA'[UniqueID] ),
    FILTER (
        'TABLEA',
        'TABLEA'[Duration]
            > CALCULATE (
                SUM ( 'TABLEB'[Duration] ),
                FILTER ( 'TABLEB', 'TABLEB'[Id] = EARLIER ( 'TABLEA'[UniqueID] ) )
            )
    )
)

COUNTID.JPG

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

Difícil de decir. Por favor, consulte este post sobre cómo obtener su pregunta respondida rápidamente: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.