Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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
User | Count |
---|---|
84 | |
78 | |
70 | |
47 | |
41 |
User | Count |
---|---|
108 | |
53 | |
50 | |
40 | |
40 |