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 dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
■Goal:
Create a DAX to dynamically combine the Items for each CustomerID and display each combination of Items and its proportion (count of CustomerID).
■What has been achieved:
・Creation of a DAX that dynamically combines the Items for each CustomerID.
・The combination changes based on the slicers (YYYYMM, Country).
For example, for CustomerID "26087", when no slicer is selected, it displays "Bicycle/Car/Motorcycle". However, when the YYYYMM slicer is set to "2019", it becomes "Car/Motorcycle".
■Main Issues:
・With the DAX created, if no CustomerID is selected, it displays the combination for all CustomerIDs.
When no slicer is selected, I would like to see a list of combinations for each CustomerID, like the following example:
DAX being used:
Measure =
VAR CurrentCustomerID = VALUES('Table'[CustomerID])
VAR SelectedYear = VALUES('Table'[YYYYMM])
VAR SelectedCountry = VALUES('Table'[Country])
VAR ProductList =
CALCULATETABLE(
VALUES('Table'[Items]),
'Table'[CustomerID] IN CurrentCustomerID,
'Table'[YYYYMM] IN SelectedYear,
'Table'[Country] IN SelectedCountry
)
VAR SortedDistinctProductList =
CONCATENATEX(
ProductList,
'Table'[Items],
"/",
'Table'[Items],
ASC
)
RETURN SortedDistinctProductList
Data source (Please use in Power BI's Query Editor):
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("nZIxT8QwDIX/Cup8g+2mvWTlNhAswHS6IVwiqDhSVCoh/j1tiJuodykVk9/wvth+8X5fUCWw2BQERFAFMZRR3ugP7Ya6011x2KRWBBHEUMSiFdgKf1pLtpb/f/Wu7dvu+H08WU8ISYoJigQlxHUT7bUQ0rtQIgQxFK/vbf9qu5N25jNHESFnOVJ4Rs2mQ6J6G4IM/XyiXj/q5utswIQATBbyeiLybYhToJDCCmahEX9MdKMCDGJ0p+aHN93b51Z35pepgA8OJxEu78k1vTVXt417Me37PIMFcKedNvpSM5Q1/ywmP4uZS1gFzDKjSkkRrGEwz1zcKN50Hpq2mcw1yC2by2guM1skfsUHrfjAclusYfxAhx8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [CustomerID = _t, YYYYMM = _t, Year = _t, Month = _t, Country = _t, Items = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"CustomerID", Int64.Type}, {"YYYYMM", Int64.Type}, {"Year", Int64.Type}, {"Month", Int64.Type}, {"Country", type text}, {"Items", type text}})
in
#"Changed Type"
Would someone be able to help me think this through?
I appreciate your assistance in advance.
Best regrds,
Solved! Go to Solution.
Hi, @Lopez0090
You can try the following methods.
Column:
Item Column = CONCATENATEX (
CALCULATETABLE ( VALUES ( 'Table'[Items] ),
FILTER ( ALL ( 'Table' ),
[CustomerID] = EARLIER ( 'Table'[CustomerID] ) ) ),
[Items],
"/"
)
Measure:
CustomerID_Count = CALCULATE(COUNT('Table'[Item Column]),ALLEXCEPT('Table','Table'[CustomerID],'Table'[Item Column],'Table'[Year]))
Your original Measure needs no change.
Please see the attached.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Lopez0090
You can try the following methods.
Column:
Item Column = CONCATENATEX (
CALCULATETABLE ( VALUES ( 'Table'[Items] ),
FILTER ( ALL ( 'Table' ),
[CustomerID] = EARLIER ( 'Table'[CustomerID] ) ) ),
[Items],
"/"
)
Measure:
CustomerID_Count = CALCULATE(COUNT('Table'[Item Column]),ALLEXCEPT('Table','Table'[CustomerID],'Table'[Item Column],'Table'[Year]))
Your original Measure needs no change.
Please see the attached.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
63 | |
59 | |
56 | |
38 | |
29 |
User | Count |
---|---|
82 | |
62 | |
45 | |
41 | |
40 |