Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
65 | |
64 | |
56 | |
39 | |
27 |
User | Count |
---|---|
85 | |
59 | |
45 | |
43 | |
38 |