Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I have a sales table, a dim_calender and dim_product table in PowerBi.
I created segments based on rankings by creating a calculated table
Solved! Go to Solution.
Hi @klaraklara ,
Below is my table:
The following DAX might work for you:
Measure = CALCULATE(SUMX('Table','Table'[Net sales]),ALLEXCEPT('Table','Table'[Segments]))
Measure 2 = CALCULATE(SUMX('Table','Table'[Net sales]),ALLEXCEPT('Table','Table'[Segments]))/CALCULATE(SUM('Table'[Net sales]),ALL('Table'))
The final output is shown in the following figure:
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @klaraklara ,
Below is my table1:
Below is my table2:
Below is my table3:
The following DAX might work for you:
Dynamic RankSales =
VAR CurrentDateFilter = ALLSELECTED(dim_Calendar[Date])
RETURN
RANKX(
FILTER(
ALLSELECTED(Sales[Article]),
CALCULATE(
SUM(Sales[Net Sales]),
FILTER(
ALLSELECTED(dim_Calendar),
dim_Calendar[Date] IN CurrentDateFilter
)
) > 0
),
CALCULATE(SUM(Sales[Net Sales])),
,
DESC,
Dense
)
Dynamic Segment =
VAR RankSales = [Dynamic RankSales]
RETURN
IF(
RankSales <= 20, "Top 10",
IF(
AND(RankSales >= 20, RankSales <= 40), "20-40",
IF(RankSales > 40, ">+40", BLANK())
)
)
The final output is shown in the following figure:
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for your support!! 🙂 That DAX works to create the measurements for ranking and segments. However, I want to group all articles within "top 20" together and see their total net sales. Since this is a measurements I can't add "Dynamic Segment" as rows in a visualization but only as a value.
I want a table like this that changes depending on which time period I choose
Hi @klaraklara ,
Below is my table:
The following DAX might work for you:
Measure = CALCULATE(SUMX('Table','Table'[Net sales]),ALLEXCEPT('Table','Table'[Segments]))
Measure 2 = CALCULATE(SUMX('Table','Table'[Net sales]),ALLEXCEPT('Table','Table'[Segments]))/CALCULATE(SUM('Table'[Net sales]),ALL('Table'))
The final output is shown in the following figure:
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
82 | |
80 | |
72 | |
71 | |
55 |
User | Count |
---|---|
108 | |
105 | |
97 | |
86 | |
68 |