Forum Discussion
DAX calculation at aggregation level excluding undelying dimension
- Anonymous7 years ago
Anonymous,
Please perform the following steps.
1.Create the following columns in your data table.
Year = YEAR(Data[Day])
Month = MONTH(Data[Day])
2. Create a new table using DAX below.Newdata = SUMMARIZE(Data,Data[Year],Data[Month],Data[Customer],"total",SUM(Data[Total sales]))
3.Create the columns below in the Newdata table.
Date = DATE(Newdata[Year],Newdata[Month],1)
year-month = Newdata[Year]&"-"&Newdata[Month]
4.Create many to many relationship between the Newdata table and proposal table.
5. Create measure in Newdata table.Measure = VAR Sales = SUM(Newdata[total]) VAR ValueAdd = MAX(Proposal[Add]) VAR ValueSubtract = MAX(Proposal[Subtract]) VAR ValueMultiply = MAX(Proposal[Multiply]) RETURN Sales+ValueAdd-ValueSubtract+(Sales-ValueSubtract)*ValueMultiply
6. Create a new table using DAX below.Temp = GENERATEALL ( Proposal, VAR proposaldate = Proposal[Date] RETURN SELECTCOLUMNS ( CALCULATETABLE ( Newdata, Newdata[Date] =proposaldate ), "Total Commission", [Measure], "YM",Newdata[year-month] ) )
For more details, please reveiw attached PBIX file.
Regards,
Lydia - 7 years ago
hi Anonymous, here you go
https://1drv.ms/u/s!AjxUGXgGNzCEiVv1OaO3j3HtxS3V
Hi Stachu,
You are right. It is 1550.
| Proposal | Date (DD/MM/YYYY) | ADD | SUBTRACT | MULTIPLY |
| PROPOsal 1 | 01/02/2018 | 500 | 200 | 0.5 |
| PROPOsal 1 | 01/03/2018 | 500 | 200 | 0.5 |
| PROPOsal 1 | 01/04/2018 | 500 | 200 | 0.5 |
| PROPOsal 2 | 01/02/2018 | 200 | 100 | 0.8 |
| PROPOsal 2 | 01/03/2018 | 200 | 100 | 0.8 |
| PROPOsal 2 | 01/04/2018 | 200 | 100 | 0.8 |
could you please share the pbix file for more clarification.
Thanks
AJBM
,,
hi Anonymous, here you go
https://1drv.ms/u/s!AjxUGXgGNzCEiVv1OaO3j3HtxS3V