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.
I have a calculated table with the following code, that I would like to get unique values from based on the earliest date for "Datum afspraak" (date appointment):
CALC NP's (Uniek) = SUMMARIZE('CALC NP''s (Niet uniek)',
'CALC NP''s (Niet uniek)'[Patiëntnummer],
'CALC NP''s (Niet uniek)'[Geslacht],
'CALC NP''s (Niet uniek)'[Online geboekt],
'CALC NP''s (Niet uniek)'[Datum afspraak],
'CALC NP''s (Niet uniek)'[Datum boeking],
'CALC NP''s (Niet uniek)'[Gebruiker],
'CALC NP''s (Niet uniek)'[Locatie])
The table currently looks like this:
I only want the rows to show that contain the earliest "Datum afspraak". There should not be any duplicate values in the column "Patiëntnummer" .Does anyone know how I can achieve this?
Solved! Go to Solution.
@Sohan , Try like
Filter(
ADDCOLUMNS( SUMMARIZE('CALC NP''s (Niet uniek)',
'CALC NP''s (Niet uniek)'[Patiëntnummer],
'CALC NP''s (Niet uniek)'[Geslacht],
'CALC NP''s (Niet uniek)'[Online geboekt],
'CALC NP''s (Niet uniek)'[Datum afspraak],
'CALC NP''s (Niet uniek)'[Datum boeking],
'CALC NP''s (Niet uniek)'[Gebruiker],
'CALC NP''s (Niet uniek)'[Locatie]
) , "_Min" , minx(filter('CALC NP''s (Niet uniek)', [Patiëntnummer] =earlier([Patiëntnummer])), 'CALC NP''s (Niet uniek)'[Datum afspraak])
)
_Min = [Datum afspraak] )
try this:-
calc =
FILTER (
ADDCOLUMNS (
SUMMARIZE (
'CALC NP''s (Niet uniek)',
'CALC NP''s (Niet uniek)'[Patiëntnummer],
'CALC NP''s (Niet uniek)'[Geslacht],
'CALC NP''s (Niet uniek)'[Online geboekt],
'CALC NP''s (Niet uniek)'[Datum afspraak],
'CALC NP''s (Niet uniek)'[Datum boeking],
'CALC NP''s (Niet uniek)'[Gebruiker],
'CALC NP''s (Niet uniek)'[Locatie]
),
"_Min",
MINX (
FILTER (
'CALC NP''s (Niet uniek)',
[Patiëntnummer] = EARLIER ( [Patiëntnummer] )
),
'CALC NP''s (Niet uniek)'[Datum afspraak]
)
),
[_Min] = [Datum afspraak]
)
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
@Sohan , Try like
Filter(
ADDCOLUMNS( SUMMARIZE('CALC NP''s (Niet uniek)',
'CALC NP''s (Niet uniek)'[Patiëntnummer],
'CALC NP''s (Niet uniek)'[Geslacht],
'CALC NP''s (Niet uniek)'[Online geboekt],
'CALC NP''s (Niet uniek)'[Datum afspraak],
'CALC NP''s (Niet uniek)'[Datum boeking],
'CALC NP''s (Niet uniek)'[Gebruiker],
'CALC NP''s (Niet uniek)'[Locatie]
) , "_Min" , minx(filter('CALC NP''s (Niet uniek)', [Patiëntnummer] =earlier([Patiëntnummer])), 'CALC NP''s (Niet uniek)'[Datum afspraak])
)
_Min = [Datum afspraak] )
@Sohan, I think , was missing, as suggested by @Samarth_18 . Make sure table name before it. and min is column [_Min]
new table =
Filter(
ADDCOLUMNS( SUMMARIZE('CALC NP''s (Niet uniek)',
'CALC NP''s (Niet uniek)'[Patiëntnummer],
'CALC NP''s (Niet uniek)'[Geslacht],
'CALC NP''s (Niet uniek)'[Online geboekt],
'CALC NP''s (Niet uniek)'[Datum afspraak],
'CALC NP''s (Niet uniek)'[Datum boeking],
'CALC NP''s (Niet uniek)'[Gebruiker],
'CALC NP''s (Niet uniek)'[Locatie]
) , "_Min" , minx(filter('CALC NP''s (Niet uniek)', [Patiëntnummer] =earlier([Patiëntnummer])), 'CALC NP''s (Niet uniek)'[Datum afspraak])
) ,
[_Min] = [Datum afspraak] )
Thanks for your response @amitchandak! It says the syntax is incorrect for "_Min = [Datum afspraak]". Any idea what I should change?
Hi @Sohan ,
There is one comma missing in the code. Below is updated code:-
FILTER (
ADDCOLUMNS (
SUMMARIZE (
'CALC NP''s (Niet uniek)',
'CALC NP''s (Niet uniek)'[Patiëntnummer],
'CALC NP''s (Niet uniek)'[Geslacht],
'CALC NP''s (Niet uniek)'[Online geboekt],
'CALC NP''s (Niet uniek)'[Datum afspraak],
'CALC NP''s (Niet uniek)'[Datum boeking],
'CALC NP''s (Niet uniek)'[Gebruiker],
'CALC NP''s (Niet uniek)'[Locatie]
),
"_Min",
MINX (
FILTER (
'CALC NP''s (Niet uniek)',
[Patiëntnummer] = EARLIER ( [Patiëntnummer] )
),
'CALC NP''s (Niet uniek)'[Datum afspraak]
)
),
_Min = [Datum afspraak]
)
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
@Samarth_18 Thank you for your reply! When I change "_Min =" to "[_Min] =" it works! I now however get the following message:
Column '' in Table '' contains a duplicate value '457-3773' and this is not allowed for columns on the one side of a many-to-one relationship or for columns that are used as the primary key of a table.
Any idea how I can get the desired result?
try this:-
calc =
FILTER (
ADDCOLUMNS (
SUMMARIZE (
'CALC NP''s (Niet uniek)',
'CALC NP''s (Niet uniek)'[Patiëntnummer],
'CALC NP''s (Niet uniek)'[Geslacht],
'CALC NP''s (Niet uniek)'[Online geboekt],
'CALC NP''s (Niet uniek)'[Datum afspraak],
'CALC NP''s (Niet uniek)'[Datum boeking],
'CALC NP''s (Niet uniek)'[Gebruiker],
'CALC NP''s (Niet uniek)'[Locatie]
),
"_Min",
MINX (
FILTER (
'CALC NP''s (Niet uniek)',
[Patiëntnummer] = EARLIER ( [Patiëntnummer] )
),
'CALC NP''s (Niet uniek)'[Datum afspraak]
)
),
[_Min] = [Datum afspraak]
)
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Covering 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 |
---|---|
111 | |
94 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |