March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Prequil - Do not ask for data, I cannot give it. If you need it to be helpful, scroll on to another question as I can do without the rude comments I often receive when requesting help from this group. Unfortunately, my company rules prevent attachments and creating a dummy dataset for this would take days but if you can translate the patient data into sales to a customer who shops at several stores from several reps, maybe you can help. Thanks in advance.
The issue:
I am getting duplications in the rows when a patient during the give date range has a change in any of these:
The Facility, The Doctor, The insurance Carrier
The desired output should be a single line that shows the following:
Last Facility visited where the specified visit type (cpt code) was applied
The Doctor they saw on that last visit
The patients name
The date of that last visit
The Carrier on that last visit
The allowed / applied & remaing units allowed by that Last Insurance Carrier
EX:
Facility / Dr / Patient / LastVisit / Current Carrier / Allowed / Used / Remaining
New Hanover Office / Martha / Larry J / 08/12/2022 / Trillium Medicaide / 24 / 6 / 18
I Have written a bit of dax that calculates:
* the allowed visits (units) a patient can have according to insurance rules,
* the used (applied units) and
* the remaining (remaining units
1) First step was to build a new column with the rules indicating how many units are allowed per insurance carrier based on the patient age
2) The I wrote the following 3 measures:
Solved! Go to Solution.
Hi there ok so without data im just gonna wing it but i think what you need to do is;
create a measure on your date ie
last appointment = max(last apt)
then replace this measure with the date on your matrix
change your other measures to
change both your
Allowed Units =
VAR maxdte =
MAX ( [last apt] )
RETURN
CALCULATE (
MAX ( MERGE_BillingSUMMARY[*C-Allowed] ),
FILTER ( 'table'[last apt], 'table'[last apt] = maxdte )
)
Applied Units =
VAR maxdte =
MAX ( [last apt] )
RETURN
CALCULATE (
SUM ( MERGE_BillingSUMMARY[Units] ),
FILTER (
MERGE_BillingSUMMARY,
MERGE_BillingSUMMARY[CPT Code]
IN {
"90791",
"90832",
"90834",
"90837",
"90839",
"90840",
"90846",
"90847",
"90853"
}
),
FILTER ( 'table'[last apt], 'table'[last apt] = maxdte )
)
Proud to be a Super User!
Hi there ok so without data im just gonna wing it but i think what you need to do is;
create a measure on your date ie
last appointment = max(last apt)
then replace this measure with the date on your matrix
change your other measures to
change both your
Allowed Units =
VAR maxdte =
MAX ( [last apt] )
RETURN
CALCULATE (
MAX ( MERGE_BillingSUMMARY[*C-Allowed] ),
FILTER ( 'table'[last apt], 'table'[last apt] = maxdte )
)
Applied Units =
VAR maxdte =
MAX ( [last apt] )
RETURN
CALCULATE (
SUM ( MERGE_BillingSUMMARY[Units] ),
FILTER (
MERGE_BillingSUMMARY,
MERGE_BillingSUMMARY[CPT Code]
IN {
"90791",
"90832",
"90834",
"90837",
"90839",
"90840",
"90846",
"90847",
"90853"
}
),
FILTER ( 'table'[last apt], 'table'[last apt] = maxdte )
)
Proud to be a Super User!
Worked like a charm! Thank you so much for the assistance!
great!
Proud to be a Super User!
On your comment about data, please understand it is difficult to give good solutions without data. Even if you can't come up with the data, if you ask questions a lot dummy data might the best way forward, sites like mockaroo make it easy to create sample data, so dont take it personally when people ask for data, they just trying to give you the best solution and also not waste a lot of their time.
Howevever I will attempt to assist you with some suggestions.
Your code is hard to read. I really do recommend you use a switch() statement if using dax for readablity when you have multiple if statements. Also if you are using imported mode and you can do your transformations in Power Query i would push the logic for that column c-allowed to there into power query not doing it in DAX through by adding a custom column.
so just so i understand clearly for a given date range you need the last record of a patient? But depending on the date range that might differ so you need to keep all records of all patients? Or do you only ever need the last record?
Proud to be a Super User!
Thanks for responding. I sent a PM with additional information that may help.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |