Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
okusai3000
Helper IV
Helper IV

Two dates and USERELATIONSHIP

Hello everyone,

 

I'm getting nuts trying to solve the following.

 

  • I have a table with VISITS to PATIENTS. 
  • Each visit is related to a PATIENT_ID.
  • Could happen that you have 2 visits to the same patient and same month.
  • Each patient will be signing a form in one moment in time. This will be registered in another column as a date ([CON_VIS_CLI).

We need to know how many people signed the form each month and how many people have we seen in total in that month.

 

For the first requeriment, I solved it using:

 

Signed People=

CALCULATE(
DISTINCTCOUNT(INDICADORES_VISITAS[ID_PACIENTE]);
USERELATIONSHIP(INDICADORES_VISITAS[CON_VIS_CLI];Calendario[Date]))
 
Talking about the people that we have visited, and still have not signed, I was doing
[Signed People] + 
CALCULATE(
DISTINCTCOUNT(INDICADORES_VISITAS[ID_PACIENTE]);
USERELATIONSHIP(INDICADORES_VISITAS[CON_VIS_CLI]=BLANK()))
 
The problem with this is that once the patient has signed, he will be not counting anymore on that measure, meaning that the numbers will be moving with the time.
 
So, what I need to do is to get a Measure where I can grab, all the different PATIENTS_ID, from the VISITS we have done in that month, that their [CON_VIS_CLI] is BLANK OR HIGHER than the selected month.
 
In other words, If I'm checking the Visited Patients from January, and someone signed on March, HE SHOULD STILL APPEAR IN JANUARY AS HE DIDN'T SIGNED. Otherwise with my old Measure, he would have dissapeared.
 
Does anyone have an idea what should I do?
 
Millions of thanks!!
 

 

1 ACCEPTED SOLUTION
vivran22
Community Champion
Community Champion

Hello @okusai3000 

 

Try this:

Form Not Signed = 

VAR _SignFormDateChek = 
    FILTER(dtPatient,
    ISBLANK(dtPatient[[CON_VIS_CLI]) || dtPatient[[CON_VIS_CLI] > dtPatient[Vistit Date]
    )
    
VAR _RowCount = 
    CALCULATE(DISTINCTCOUNT(dtPatient[PATIENT_ID]),_SignFormDateChek
    )
RETURN
_RowCount

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂

https://www.vivran.in/

Connect on LinkedIn

View solution in original post

3 REPLIES 3
vivran22
Community Champion
Community Champion

Hello @okusai3000 

 

Try this:

Form Not Signed = 

VAR _SignFormDateChek = 
    FILTER(dtPatient,
    ISBLANK(dtPatient[[CON_VIS_CLI]) || dtPatient[[CON_VIS_CLI] > dtPatient[Vistit Date]
    )
    
VAR _RowCount = 
    CALCULATE(DISTINCTCOUNT(dtPatient[PATIENT_ID]),_SignFormDateChek
    )
RETURN
_RowCount

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂

https://www.vivran.in/

Connect on LinkedIn

Sir, I simply LOVE YOU. 

 

That was the solution.. Thank you so much.

 

 

Form Not Signed = 

VAR _SignFormDateChek = 
    FILTER(dtPatient,
    ISBLANK(dtPatient[[CON_VIS_CLI]) || dtPatient[[CON_VIS_CLI] >= dtPatient[Vistit Date]
    )
    
VAR _RowCount = 
    CALCULATE(DISTINCTCOUNT(dtPatient[PATIENT_ID]),_SignFormDateChek
    )
RETURN
_RowCount

 

 

v-juanli-msft
Community Support
Community Support

Hi @okusai3000 

Could you show a simple example and expected result to make me clear?

 

Best Regards

Maggie

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.