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.
I have a requirement where I have to calculate the NetSales with the lookup table shown in below image.
can i create new table as shown below ?
Thanks in advance. Please let me know if this is possible in desktop. I have tried the same in Power query and i get the rows Quantity1, Quantity2 and Quantity3 as they are direct data. Please help me on the above requirement.
Solved! Go to Solution.
Hi @Anonymous ,
You can create a calculated table, please refer to the formula below.
New Table =
DISTINCT (
UNION (
SELECTCOLUMNS (
'Table',
"quantity", "quantity",
"2018", CALCULATE (
SUM ( 'Table'[quantity] ),
FILTER ( 'Table', 'Table'[date] = 2018 )
),
"2019", CALCULATE (
SUM ( 'Table'[quantity] ),
FILTER ( 'Table', 'Table'[date] = 2019 )
)
),
SELECTCOLUMNS (
'Table',
"quantity", "sales",
"2018", CALCULATE ( SUM ( 'Table'[sales] ), FILTER ( 'Table', 'Table'[date] = 2018 ) ),
"2019", CALCULATE ( SUM ( 'Table'[sales] ), FILTER ( 'Table', 'Table'[date] = 2019 ) )
)
)
)
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Have your problem be solved? Please consider accept the answer as a solution if it worked.
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
You can create a calculated table, please refer to the formula below.
New Table =
DISTINCT (
UNION (
SELECTCOLUMNS (
'Table',
"quantity", "quantity",
"2018", CALCULATE (
SUM ( 'Table'[quantity] ),
FILTER ( 'Table', 'Table'[date] = 2018 )
),
"2019", CALCULATE (
SUM ( 'Table'[quantity] ),
FILTER ( 'Table', 'Table'[date] = 2019 )
)
),
SELECTCOLUMNS (
'Table',
"quantity", "sales",
"2018", CALCULATE ( SUM ( 'Table'[sales] ), FILTER ( 'Table', 'Table'[date] = 2018 ) ),
"2019", CALCULATE ( SUM ( 'Table'[sales] ), FILTER ( 'Table', 'Table'[date] = 2019 ) )
)
)
)
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
What is the formula for nestsales1 and netsales2?
TO get that kind of display, you have a property in matrix visualization. Show on row. That will you columns on row. And then drag year on the column.
In case you have date prefer using a calendar for date, month and year etc
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.
Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
Thanks for that @amitchandak . The formula for netsales1 is Rate1 * Quantity1 and for netSales2 is Rate2 * Quantity2
My actual requirement is to get as the below image.
I actually need YTD columns for Quantity and sales respectively. If I create a table as i said in the previous message then I thought I will get YTD columns by using measures.
Let me know if we can do anything to get as shown in above fig.
You can get YTD like this. But kind of display you need is a big challenge
nets Sales ytd= CALCULATE(SUMX(Table,Rate1 * Quantity1),DATESYTD('Date'[Date]))
nets Sales2ytd= = CALCULATE(SUMX(Table,Rate1 * Quantity1),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year))))
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 |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |