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 everyone,
I'm new to power BI, and I'm hoping someone can help me.
I' m trying to achieve the result table in the snapshot below using power BI DAX
I have a database with following data.
My Request
2.1. based on selected sales team using Power BI Slicer (sample in column F8:G10)
2.2. The DAX code will compare column named "Sales Year" to column named "Fiscal Year" to ensure the right sales numbers are returned for the teams in each year in column F.
I will appreciate it if someone could help me.
Many thanks
Solved! Go to Solution.
Hi @Boyo ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) If you want to display data on a visual object, place the fields as shown in the figure below.
(3)If you want to create a new table, go to modeling->new table->Modify column name[Fiscal Year].
Table 2 = VALUES('Table'[Sales Year])
Then we can add a column which, by design, is not affected by the TEAM of Table 1, and create a measure if you want the total value to be filtered by the slicer. Measure values do not appear in the data view, they can only be rendered on the visual object.
Yearly Sales Total = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Sales Year]=EARLIER('Table 2'[Fiscal Year]) ))
Measure (Yearly Sales Total) = CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[Sales Year]=MAX('Table 2'[Fiscal Year]) && 'Table'[Sales Team] in VALUES('Table'[Sales Team])))
Measure = SUMX(SUMMARIZE('Table 2','Table 2'[Fiscal Year], "total",[Measure (Yearly Sales Total)]),[total])
(4) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Boyo ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) If you want to display data on a visual object, place the fields as shown in the figure below.
(3)If you want to create a new table, go to modeling->new table->Modify column name[Fiscal Year].
Table 2 = VALUES('Table'[Sales Year])
Then we can add a column which, by design, is not affected by the TEAM of Table 1, and create a measure if you want the total value to be filtered by the slicer. Measure values do not appear in the data view, they can only be rendered on the visual object.
Yearly Sales Total = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Sales Year]=EARLIER('Table 2'[Fiscal Year]) ))
Measure (Yearly Sales Total) = CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[Sales Year]=MAX('Table 2'[Fiscal Year]) && 'Table'[Sales Team] in VALUES('Table'[Sales Team])))
Measure = SUMX(SUMMARIZE('Table 2','Table 2'[Fiscal Year], "total",[Measure (Yearly Sales Total)]),[total])
(4) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Solution accepted - Many thanks for your help.
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 |
---|---|
108 | |
99 | |
82 | |
67 | |
63 |
User | Count |
---|---|
145 | |
111 | |
104 | |
84 | |
64 |