The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Good morning,
I have a data set, but prefer to keep it conceptual, then if possible, I will work on the actual dax formula.
I am attempting to calculate the product of a column by date, but calculated in this manner: January's result * February's result * March's result = [Result I'm after].
I am aware that I can use the calculate the product from Jan thru March, but my data set is stock returns, therefore, the returns have to be calculated by date & in order.
Is this possible with dax? Any tips or ideas??
Thank you & kindly,
James k.
Solved! Go to Solution.
Hi @Jkaelin,
I create the following sample table, the data is from 2013/1/1 to 5015/7/20. I think it is similar with your data set structure.
1. Create a calculate to get Month using the formula:
Month = FORMAT(Stock[date],"MMM") YEAR = YEAR(Stock[date])
2. Please create a measure based on the new table. Create a table visual to display the result. Please see the following screenshot, it shows January's result * February's result * March's result in very year.
Result = CALCULATE(SUM(Stock[price]),FILTER(Stock,Stock[Month]="Jan"))*CALCULATE(SUM(Stock[price]),FILTER(Stock,Stock[Month]="Feb"))*CALCULATE(SUM(Stock[price]),FILTER(Stock,Stock[Month]="Mar"))
Don't hesitate to ask if you have any other issue.
Best Regards,
Angelia
Hi @Jkaelin,
I create the following sample table, the data is from 2013/1/1 to 5015/7/20. I think it is similar with your data set structure.
1. Create a calculate to get Month using the formula:
Month = FORMAT(Stock[date],"MMM") YEAR = YEAR(Stock[date])
2. Please create a measure based on the new table. Create a table visual to display the result. Please see the following screenshot, it shows January's result * February's result * March's result in very year.
Result = CALCULATE(SUM(Stock[price]),FILTER(Stock,Stock[Month]="Jan"))*CALCULATE(SUM(Stock[price]),FILTER(Stock,Stock[Month]="Feb"))*CALCULATE(SUM(Stock[price]),FILTER(Stock,Stock[Month]="Mar"))
Don't hesitate to ask if you have any other issue.
Best Regards,
Angelia
Thanks @v-huizhn-msft
This seems to work well. I spent much time working on this yesterday. Another solution for me was to create a "productx" function and use the date to summarize the results. Both work great & thank you for looking into this for me!!
You could create a SUMMARIZE table grouped by month and then measures off of that table to grab the numbers for Jan, Feb, March and multiply them together. Sample data would provide a more useful response.
User | Count |
---|---|
68 | |
63 | |
59 | |
54 | |
28 |
User | Count |
---|---|
182 | |
81 | |
63 | |
47 | |
41 |