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.
hi i am new to power bi and i want to calculate the sales of last 3 months and compare with the current month. i have connected thye power bi with SSAS in a live mode . please help me
Solved! Go to Solution.
Hi @Anonymous ,
You can refer to this sample of DAX:
current_month_sales = CALCULATE(SUM('Table1'[Sales]),FILTER('Table1',MONTH('Table1'[Month])=MONTH(TODAY())))
last_3month_sales =
var current_month= MONTH(TODAY())
var P_month = CALCULATE(SUM('Table1'[Sales]),FILTER('Table1',MONTH('Table1'[Month])=current_month -1))
var p_p_month = CALCULATE(SUM('Table1'[Sales]),FILTER('Table1',MONTH('Table1'[Month])=current_month -2))
return P_month + p_p_month + [current_month_sales]
Also You can refer to this post about using MDX to solve the problem
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
I want to create a dashboard comparing the current month, previous month and previous 3 months. Since i have connected my powe bi with SSAS cube in LIve mode i cannot use the dateadd function as i am having duplicate dates in my data and i shows an error. please help me with it and provide me query or solution to fix my problem
If you want to compare only the current month with the previous one then take the DAX-formular: "Previousmonth"
Kind regards,
Frank
Hi @Anonymous ,
You can refer to this sample of DAX:
current_month_sales = CALCULATE(SUM('Table1'[Sales]),FILTER('Table1',MONTH('Table1'[Month])=MONTH(TODAY())))
last_3month_sales =
var current_month= MONTH(TODAY())
var P_month = CALCULATE(SUM('Table1'[Sales]),FILTER('Table1',MONTH('Table1'[Month])=current_month -1))
var p_p_month = CALCULATE(SUM('Table1'[Sales]),FILTER('Table1',MONTH('Table1'[Month])=current_month -2))
return P_month + p_p_month + [current_month_sales]
Also You can refer to this post about using MDX to solve the problem
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you
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 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |