'How to write this Logic in DAX
I'd like to know how to write this line bellow in DAX. I'm a beginner and I'm having a lot of problems trying to write this code in Dax to return the value I need.
(select
top 1 Payor.CompanyName
from Payor, PatientPayor
where PatientPayor.PatientSer = pat.PatientSer
and Payor.PayorSer = PatientPayor.PayorSer) as conv,
This is what I tried to do so far.
Convenio =
TOPN ( 1, VALUES ( Payor[CompanyName] ), PatientPayor[PatientSer] )
= FILTER ( Patient, PatientPayor[PatientSer] = Patient[PatientSer] )
Solution 1:[1]
I did solve it with the code bellow:
formula = VAR currpayorSer = SELECTEDVALUE ( PatientPayor[PayorSer] ) VAR currPatientSer = SELECTEDVALUE ( PatientPayor[PatientSer] ) RETURN CALCULATE ( MIN ( Payor[CompanyName] ), FILTER ( ALLSELECTED ( Payor ), Payor[PayorSer] = currpayorSer ), FILTER ( ALLSELECTED ( Patient ), Patient[PatientSer] = currPatientSer ) )
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gustavo Lopes |
