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.
Tengo un cálculo que es muy simple en SQL, pero no estoy teniendo éxito en obtener una medida DAX para hacer lo mismo.
declare @FromDate date = '2020-08-01';
declare @ToDate date = '2020-08-31';
with lia as
( -- Get list of accounts that meet the criteria
select distinct AccountNo
from factLoan_Day fld
where dimDate between @FromDate and @ToDate
and Flag1 = 'Y'
)
-- For that list of accounts, divide the cash collected by the amount due
select SUM(case when dtt.IsCashCollected = 'Y' then ft.transactionamount end)
,SUM(case when dtt.TransactionType= 'DUE' then ft.transactionamount end)
,SUM(case when dtt.IsCashCollected = 'Y' then ft.transactionamount end) / SUM(case when dtt.TransactionType = 'DUE' then ft.transactionamount end)
from lia
join factTransaction ft on ft.AccountNo = lia.AccountNo
join dimTransactionType dtt on dtt.dimTransactionType = ft.dimTransactionType
where ft.dimDate between @FromDate and @ToDate;
¿Alguna idea?
Puede utilizar la función SWITCH con Calcular y Filtrar!
Si usted tiene los datos de muestra, entonces es mucho más fácil de explicar!
Proud to be a Super User!
Hola @EylesIT ,
¿Cómo tiene la configuración del modelo en Power BI también tiene todas las tablas a las que hace referencia en la consulta SQL? ¿Y tienes alguna relación entre las mesas?
En función de eso, la sintaxis DAX puede ser diferente y, en algunos casos, puede que ni siquiera sea necesaria para realizar cálculos complejos porque las medidas se basan en el contexto.
Si puede compartir algunos datos de muestra y el resultado esperado woud ser excelente.
Consulte esta publicación sobre cómo obtener respuestas a su pregunta rápidamente (cortesía de @Greg_Deckler) y Cómo proporcionar datos de ejemplo en el foro de Power BI (cortesía de @ImkeF).
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCovering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |