Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
I have data Amount and Date in a table and wanted to calculate some time functions. I dont want to use any calendar table here. I derived Year and Month from the date field and using it for filters.
I do have filters like Year and Month. When I select Year 2022 and Month APRIL
1) Selected Month and Year: I just used SUM(Amount) -- I am getting correct results.
2) Same selected Month and Year but Last Year:
Solved! Go to Solution.
Hi @Anonymous ,
Please try:
Last Year Same Month =
CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),YEAR([Date])=SELECTEDVALUE('Table'[Date].[Year])-1 && MONTH([Date])=MAX('Table'[Date].[MonthNo])))FY = IF(MONTH(MAX('Table'[Date]))<4, YEAR(MAX('Table'[Date]))-1 , YEAR(MAX('Table'[Date])) )FY Sum = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),[FY]=MAXX('Table',[FY]))) Last Year YTD = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),[FY]=MAXX('Table',[FY])-1))
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Please try:
Last Year Same Month =
CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),YEAR([Date])=SELECTEDVALUE('Table'[Date].[Year])-1 && MONTH([Date])=MAX('Table'[Date].[MonthNo])))FY = IF(MONTH(MAX('Table'[Date]))<4, YEAR(MAX('Table'[Date]))-1 , YEAR(MAX('Table'[Date])) )FY Sum = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),[FY]=MAXX('Table',[FY]))) Last Year YTD = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),[FY]=MAXX('Table',[FY])-1))
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Yes it worked, much appreciated your support.
Hi,
Why do you not want to create a Calendar Table?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 43 | |
| 39 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 67 | |
| 63 | |
| 30 | |
| 30 | |
| 23 |