Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
I want the column to return only the datekey that is after the NP date.
The new patient ID is returned if the Feecode is in (4 fee codes which show this is a new patient, not shown in this capture). I want to have all the datekey >= the new patient entry datekey (in this capture, it is 20210507). And those before this datekey should be 0. Am I able to do that?
Solved! Go to Solution.
Hi @TonyGu
Try this code to add a new column:
NPID =
VAR _NPD =
CALCULATE ( MAX ( 'Table'[NPdate] ), ALLEXCEPT ( 'Table', 'Table'[PatientId] ) )
RETURN
IF ( 'Table'[EntryDateKey] >= _NPD, 'Table'[EntryDateKey], BLANK () )
output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
Hi @TonyGu
Try this code to add a new column:
NPID =
VAR _NPD =
CALCULATE ( MAX ( 'Table'[NPdate] ), ALLEXCEPT ( 'Table', 'Table'[PatientId] ) )
RETURN
IF ( 'Table'[EntryDateKey] >= _NPD, 'Table'[EntryDateKey], BLANK () )
output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
Thanks! This actually works!
Hi,
I am not completely sure I understood what you want. What you are describing can be achieved with a simple IF clause, but if you want a list of dates (e.g. all the dates after patient admission. I would create a filter measure and use that in visuals. Ping me with @ IF this is the case).
Here is the calculated column DAX:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
Proud to be a Super User!
Thank you for replying. I might have not explained properly what I want. Here is another capture.
The place I circled in blue is where I want to have the data. Other cell should remain blank.
I want to compare the 'EntryDateKey' with the 'NP Date' for each New_PatientID. For the same patient ID, if the 'EntryDateKey' is greater or equal to the 'NP Date', NPID will equal to the 'EntryDateKey', other should remain blank. Is it possible to do that?
Hi,
Here is the updated dax based on your updated problem description:
Proud to be a Super User!
Hi,
Sorry, but it doesn't work. I don't think MAX() is working since each PatientID has an Entry Date key and I want all the datekey greater than that.
I've created a simple version of what result I want. For Type A, at entry # 2, I want to have 2,3,4 to be returned in the column. As for Type B, I want to have 3 and 4 to be returned.
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!