Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello everybody,
i have the following table SALES that shows the sales per department
.
COD_STORE | DES_STORE | COD_DEPARTMENT | DES_DEPARTMENT | SALES | DATE |
0002 | STORE_1 | 0002051 | DEPARTMENT_1 | $ 1.068.811 | 20180102 |
0002 | STORE_1 | 0002052 | DEPARTMENT_2 | $ 77.611 | 20180102 |
0002 | STORE_1 | 0002053 | DEPARTMENT_3 | $ 405.608 | 20180102 |
0002 | STORE_1 | 0002060 | DEPARTMENT_4 | $ 84.680 | 20180102 |
0002 | STORE_1 | 0002061 | DEPARTMENT_5 | $ 222.855 | 20180102 |
0002 | STORE_1 | 0002062 | DEPARTMENT_6 | $ 207.413 | 20180102 |
0002 | STORE_1 | 0002064 | DEPARTMENT_7 | $ 81.772 | 20180102 |
0002 | STORE_1 | 0002066 | DEPARTMENT_8 | $ 280.714 | 20180102 |
0002 | STORE_1 | 0002070 | DEPARTMENT_9 | $ 23.850 | 20180102 |
0002 | STORE_1 | 0002071 | DEPARTMENT_10 | $ 12.693 | 20180102 |
0002 | STORE_1 | 0002072 | DEPARTMENT_11 | $ 3.252 | 20180102 |
0002 | STORE_1 | 0002073 | DEPARTMENT_12 | $ 9.124 | 20180102 |
0002 | STORE_1 | 0002080 | DEPARTMENT_13 | $ 2.495.266 | 20180102 |
0002 | STORE_1 | 0002081 | DEPARTMENT_14 | $ 2.495.266 | 20180102 |
0002 | STORE_1 | 0002082 | DEPARTMENT_15 | $ 2.495.266 | 20180102 |
0002 | STORE_1 | 0002083 | DEPARTMENT_16 | $ 2.495.266 | 20180102 |
0002 | STORE_1 | 0002084 | DEPARTMENT_17 | $ 2.495.266 | 20180102 |
0002 | STORE_1 | 0002085 | DEPARTMENT_18 | $ 2.495.266 | 20180102 |
0002 | STORE_1 | 0002086 | DEPARTMENT_19 | $ 2.495.266 | 20180102 |
0002 | STORE_1 | 0002099 | DEPARTMENT_20 | $ 2.495.266 | 20180102 |
I've marked in red the departments wich has assigned the sales of the entire store.
I also have the following table tha defines every department as a part of a segment
COD_STORE | DES_STORE | COD_SEGMENT | DES_SEGMENT | COD_DEPARTMENT | DES_DEPARTMENT |
0002 | STORE_1 | 0002A23066 | SEGMENT_1 | 0002060 | DEPARTMENT_4 |
0002 | STORE_1 | 0002A23066 | SEGMENT_1 | 0002066 | DEPARTMENT_8 |
0002 | STORE_1 | 0002A24062 | SEGMENT_2 | 0002061 | DEPARTMENT_5 |
0002 | STORE_1 | 0002A24062 | SEGMENT_2 | 0002062 | DEPARTMENT_6 |
0002 | STORE_1 | 0002A24062 | SEGMENT_2 | 0002064 | DEPARTMENT_7 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002051 | DEPARTMENT_1 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002052 | DEPARTMENT_2 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002053 | DEPARTMENT_3 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002070 | DEPARTMENT_9 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002071 | DEPARTMENT_10 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002072 | DEPARTMENT_11 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002073 | DEPARTMENT_12 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002080 | DEPARTMENT_13 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002081 | DEPARTMENT_14 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002082 | DEPARTMENT_15 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002083 | DEPARTMENT_16 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002084 | DEPARTMENT_17 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002085 | DEPARTMENT_18 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002086 | DEPARTMENT_19 |
0002 | STORE_1 | 0002A34099 | SEGMENT_4 | 0002099 | DEPARTMENT_20 |
What i would like to show is the sales per segment like this
COD_STORE | DES_STORE | COD_SEGMENT | DES_SEGMENT | SALES |
0002 | STORE_1 | 0002A23066 | SEGMENT_1 | $ 365.394,00 |
0002 | STORE_1 | 0002A24062 | SEGMENT_2 | $ 512.040,00 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | $ 2.495.266,00 |
0002 | STORE_1 | 0002A34099 | SEGMENT_4 | $ 2.495.266,00 |
and not like this
COD_STORE | DES_STORE | COD_SEGMENT | DES_SEGMENT | SALES |
0002 | STORE_1 | 0002A23066 | SEGMENT_1 | $ 365.394,00 |
0002 | STORE_1 | 0002A24062 | SEGMENT_2 | $ 512.040,00 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | $ 19.067.811,00 |
0002 | STORE_1 | 0002A34099 | SEGMENT_4 | $ 2.495.266,00 |
Any suggestion?
Thanks
Solved! Go to Solution.
I solved it creating the following measures:
Whit the two new measures I've finally created the measure that can solve my problem:
Thanks everyone for the support.
I solved it creating the following measures:
Whit the two new measures I've finally created the measure that can solve my problem:
Thanks everyone for the support.
Hi @Stevo164,
Is there an indicator/column that indicates what should be red? If yes, you could use that condition as filter.
For example: Calculate(Sum(Table[Sales]), filter(Table, Table(Condition)....)
Does this help?
Hi @Anonymous,
thank you for your help.
I've the following tables
I've created a new table called DEPARTMENTS which defines what departments are red by the column CONDITION_RED
COD_STORE | DES_STORE | COD_SEGMENT | DES_SEGMENT | COD_DEPARTMENT | DES_DEPARTMENT | CONDITION_RED |
0002 | STORE_1 | 0002A23066 | SEGMENT_1 | 0002060 | DEPARTMENT_4 | 0 |
0002 | STORE_1 | 0002A23066 | SEGMENT_1 | 0002066 | DEPARTMENT_8 | 0 |
0002 | STORE_1 | 0002A24062 | SEGMENT_2 | 0002061 | DEPARTMENT_5 | 0 |
0002 | STORE_1 | 0002A24062 | SEGMENT_2 | 0002062 | DEPARTMENT_6 | 0 |
0002 | STORE_1 | 0002A24062 | SEGMENT_2 | 0002064 | DEPARTMENT_7 | 0 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002051 | DEPARTMENT_1 | 0 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002052 | DEPARTMENT_2 | 0 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002053 | DEPARTMENT_3 | 0 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002070 | DEPARTMENT_9 | 0 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002071 | DEPARTMENT_10 | 0 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002072 | DEPARTMENT_11 | 0 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002073 | DEPARTMENT_12 | 0 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002080 | DEPARTMENT_13 | 1 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002081 | DEPARTMENT_14 | 1 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002082 | DEPARTMENT_15 | 1 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002083 | DEPARTMENT_16 | 1 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002084 | DEPARTMENT_17 | 1 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002085 | DEPARTMENT_18 | 1 |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | 0002086 | DEPARTMENT_19 | 1 |
0002 | STORE_1 | 0002A34099 | SEGMENT_4 | 0002099 | DEPARTMENT_20 | 1 |
I've tried your solution but the result isn't what I need
CALCULATE(SUM(SALES[SALES]);DEPARTMENTS[CONDITION_RED]="1")
COD_STORE | DES_STORE | COD_SEGMENT | DES_SEGMENT | SALES |
0002 | STORE_1 | 0002A23066 | SEGMENT_1 | |
0002 | STORE_1 | 0002A24062 | SEGMENT_2 | |
0002 | STORE_1 | 0002A27051 | SEGMENT_3 | $ 19.067.811,00 |
0002 | STORE_1 | 0002A34099 | SEGMENT_4 | $ 2.495.266,00 |
Hi @Anonymous;
I've already tried this solution but it doesn't work for me, beacause I have daily sales grouped by week.
It would show the average sales per day.
@Stevo164,
Create measure using DAX below.
Measure = IF(MAX(TRANSCODING_DEP_SEG[CONDITION_RED])=1;MAX(Sales[SALES]);SUM(Sales[SALES]))
Regards,
Lydia
Thank you @v-yuezhe-msft for your kind answer, but it's not working for me, because I have the sales per day and it will show the max sales in a day.
@Stevo164,
I make a test using your sample data, you can check this PBIX file. If you still have questions about the DAX, please share your PBIX file via Private Message, I will test it in my environment.
Regards,
Lydia
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |