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 need to summarize a table based on DISTINCT values from the column Taak[Taakset] and then the value from COMMENT.
And then filtered based on a certain GridzStatus and Comments <> BLANK()
But i'm unable to incorperate the DISTINCT VALUE in this formula, can anyone help me
test =
CALCULATETABLE(
SUMMARIZE(
Taak,
Taak[Taakset],
Taak[Comments]),
Filter(Taak,Taak[Comments]<>BLANK() && Taak[GridzStatus]="On_HOLD"))
Hi @RonaldvdH ,
Your issue comes from how SUMMARIZE works with filtering and distinct values. The best way to approach this is to first apply filtering on the table and then summarize the results. You can achieve this by defining a variable that filters out rows where Taak[Comments] is blank and Taak[GridzStatus] is not "On_HOLD". After filtering, you can use SUMMARIZE to extract the distinct values.
test =
VAR FilteredTable =
FILTER(
Taak,
Taak[Comments] <> BLANK() && Taak[GridzStatus] = "On_HOLD"
)
RETURN
SUMMARIZE(
FilteredTable,
Taak[Taakset],
Taak[Comments]
)
If your goal is to ensure that Taakset remains strictly distinct, meaning you do not want duplicate values based on different comments, you can use DISTINCT along with SELECTCOLUMNS to create a more refined table.
test =
VAR FilteredTable =
FILTER(
Taak,
Taak[Comments] <> BLANK() && Taak[GridzStatus] = "On_HOLD"
)
RETURN
DISTINCT(
SELECTCOLUMNS(
FilteredTable,
"Taakset", Taak[Taakset],
"Comments", Taak[Comments]
)
)
This approach ensures that the filtering is applied before summarization, avoiding any unwanted duplicates in the final summarized table. Let me know if you need further refinements!
Best regards,
@DataNinja777 your formula looks good but i'm still getting duplicate values in Taak[Taakset]
the Comments are different so i'm guessing it doesnt see the Distinct part of the summarize
ON-HOLD comments =
VAR FilteredTable =
FILTER(
Taak,
Taak[Comments] <> BLANK() && Taak[GridzStatus] = "On_HOLD"
)
RETURN
DISTINCT(
SELECTCOLUMNS(
FilteredTable,
"Taakset", Taak[Taakset],
"Comments", Taak[Comments]
)
)
Hi @RonaldvdH ,
You're right that the DISTINCT function applies to the entire row, meaning if Taakset has different Comments, it will still create separate rows. To ensure that each Taakset appears only once while aggregating all related Comments, you can use CONCATENATEX to combine the comments into a single field.
ON-HOLD comments =
VAR FilteredTable =
FILTER(
Taak,
Taak[Comments] <> BLANK() && Taak[GridzStatus] = "On_HOLD"
)
RETURN
ADDCOLUMNS(
DISTINCT(SELECTCOLUMNS(FilteredTable, "Taakset", Taak[Taakset])),
"Comments", CONCATENATEX(FILTER(FilteredTable, Taak[Taakset] = EARLIER([Taakset])), Taak[Comments], ", ")
)
This approach first filters out the rows where Comments is blank and GridzStatus is "On_HOLD". Then, it ensures that Taakset remains distinct by selecting only unique values. To handle the Comments, ADDCOLUMNS is used to create a new column where CONCATENATEX gathers all comments associated with each Taakset, joining them with a comma and space. This way, each Taakset appears only once with its corresponding comments combined into a single text value. Let me know if this solution works for your dataset!
Best regards,
@DataNinja777 you are the best, that worked.
Last question....
I need an extra column from the table Taak but how do I add a third column to this formula ?
ON-HOLD comments =
VAR FilteredTable =
FILTER(
Taak,
Taak[Comments] <> BLANK() && Taak[GridzStatus] = "On_HOLD"
)
RETURN
ADDCOLUMNS(
DISTINCT(SELECTCOLUMNS(FilteredTable, "Taakset", Taak[Taakset])),
"HLD-code",Taak[omschrijving],
"Comments", CONCATENATEX(FILTER(FilteredTable, Taak[Taakset] = EARLIER([Taakset])), Taak[Comments], " || ")
)
this is the third column: "HLD-code",Taak[omschrijving],
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
76 | |
75 | |
43 | |
36 |
User | Count |
---|---|
109 | |
56 | |
52 | |
48 | |
43 |