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.
Dear all,
I am using this formula to find previous month sales
CMSales = CALCULATE(SUM(Dispatch[InvoiceAmount]),FILTER('Calendar','Calendar'[YearMonthnumber]=max('Calendar'[YearMonthnumber])-1))
but i am not getting the result
when i checked
test = MAX('Calendar'[YearMonthnumber]) i am getting 201803
but for MAX('Calendar'[YearMonthnumber])-1 i am getting 201.80 but i should get 201802
pls correct where i am wrong.
Regards,
Joshua.
Solved! Go to Solution.
Hi @Anonymous
Based on my test, the test measure seems correct. You may check the format for it. You may try to change your CMSales measure as below to get previous month sales.
CMSales = CALCULATE ( SUM ( Dispatch[InvoiceAmount] ), FILTER ( ALL ( 'calendar' ), 'Calendar'[YearMonthnumber] = MAX ( 'Calendar'[YearMonthnumber] ) - 1 ) )
Regards,
Cherie
Hi,
If there is a relationship from the Date column of the Dispatch Table to the Date column of the Calendar Table, then this simple mesure should work
=CALCULATE(SUM(Dispatch[InvoiceAmount]),PREVIOUSMONTH('Calendar'[Date]))
Hope this helps.
Hi @Anonymous
Based on my test, the test measure seems correct. You may check the format for it. You may try to change your CMSales measure as below to get previous month sales.
CMSales = CALCULATE ( SUM ( Dispatch[InvoiceAmount] ), FILTER ( ALL ( 'calendar' ), 'Calendar'[YearMonthnumber] = MAX ( 'Calendar'[YearMonthnumber] ) - 1 ) )
Regards,
Cherie
@Anonymous Please make sure your "YearMonthNumber" is in Number format, if not then try using "VALUE" function in your logic or change the datatype of your "YearMonthNumber" field.
Might be helpful....
Proud to be a PBI Community Champion
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 |
---|---|
107 | |
98 | |
78 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |