The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi guys, I need to segment my products into 4 groups all with distinct MIN & MAX ranges as shown below. I am wondering how best to create a dax measure to segment my products into these groups. Furthermore, I need to essentially have the ability to use that Product Type Group Name to be used within the Legend Field of a visuals (Scatter Chart) to visually showcase the sgementation over time. Currently, the scatter chart legend field only accepts colum references and not measures. Any help would be greatly appreciated!!
First, we need to create a calculated column instead of a measure since the scatter chart legend field only accepts column references. Let's create a new column named 'Product Type' in your table.
Here's a DAX formula for the 'Product Type' column:
Product Type =
VAR SalesRank = [Sales Rank]
VAR MarginRank = [Margin Rank]
RETURN
IF(
(SalesRank >= 950 && SalesRank <= 1050) && (MarginRank >= 950 && MarginRank <= 1050), "CORE",
IF(
(SalesRank >= 850 && SalesRank < 950) && (MarginRank >= 850 && MarginRank < 950), "VITAL",
IF(
(SalesRank >= 0 && SalesRank < 850) && (MarginRank >= 850 && MarginRank <= 1050), "POOR",
IF(
(SalesRank >= 0 && SalesRank < 850) && (MarginRank >= 0 && MarginRank < 850), "BAD",
BLANK()
)
)
)
)
This formula checks the Sales Rank and Margin Rank of each product and assigns it to one of the four categories. If a product doesn't fit into any of the categories, it will return a blank value.
Once you've added this column, you can use the 'Product Type' column in the Legend Field of your scatter chart to visually showcase the segmentation over time. This way, each product will be color-coded based on its segment, making it easy to see how products are distributed across the four categories over time.
User | Count |
---|---|
12 | |
8 | |
7 | |
6 | |
5 |
User | Count |
---|---|
20 | |
15 | |
14 | |
10 | |
7 |