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.
Hello All,
I am not getting correct t calculated value for previous Month column , For example in below screen shot CM sales for March =3,881,693. in PM Sales column of April month i am expecting 3,881,693.
CM Sales = CALCULATE(SUM('sales'[salesamt]), bcalendar[byear]= YEAR(TODAY()))-- Current Year Sales by month PM Sales = CALCULATE (SUM('sales'[salesamt]),PREVIOUSMONTH(bcalendar[bdate]), bcalendar[biyear]= YEAR(TODAY())) ---Current Year Previous Month Sales
Solved! Go to Solution.
Hi @prasy14,
Please try this:
PM Sales = CALCULATE ( SUM ( 'Sales'[SalesAmount] ), FILTER ( ALLSELECTED ( 'bcalendar' ), 'bcalendar'[bdate].[MonthNo] = MONTH ( MAX ( 'bcalendar'[bdate] ) ) - 1 && 'bcalendar'[byear] = YEAR ( TODAY () ) ) )
Regards,
Yuliana Gu
Hi @prasy14,
Please try this:
PM Sales = CALCULATE ( SUM ( 'Sales'[SalesAmount] ), FILTER ( ALLSELECTED ( 'bcalendar' ), 'bcalendar'[bdate].[MonthNo] = MONTH ( MAX ( 'bcalendar'[bdate] ) ) - 1 && 'bcalendar'[byear] = YEAR ( TODAY () ) ) )
Regards,
Yuliana Gu
You can try:
PM Sales = CALCULATE ( [CM Sales],PREVIOUSMONTH(bcalendar[bdate]) ) ---Current Year Previous Month Sales
Though if it were me, i'd have a 'Year' slicer, to make it easier.
Hello @mattbrice,
i have to display Current Year,Last Year, LLY,LLLY by months as well that is reason i am not using year slicer.
the code which you have provided is giving me blank values.
Does your 'bcalendar' table include dates for the prior month? prior year?
Hi @BILASolution,
Thanks for PBIX file, I still get blank values when i use the DAX and I do have same relationship between the tables as yours
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 |
---|---|
110 | |
97 | |
78 | |
64 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |