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 August 31st. Request your voucher.
Hello all,
I'm trying to get the count of orders for a previous year. I have the answer via filters, but I'm trying to get it in a measure as part of a larger calculation. However, the below function does not seem to be filtering the data and is instead returning the results of all the years. Anyone know why?
Solved! Go to Solution.
You can try:
Count of Orders in the Previous Year = CALCULATE([Multi Origin Order Count], Filter(FactTable, [Datecolumn] = YEAR(today())-1))
If its a datatimecolumn use YEAR([datecolumn]) ofcourse.
You can try:
Count of Orders in the Previous Year = CALCULATE([Multi Origin Order Count], Filter(FactTable, [Datecolumn] = YEAR(today())-1))
If its a datatimecolumn use YEAR([datecolumn]) ofcourse.
I swapped the filtering of the fact table to filter the date dim table and that worked per your solution.
Count of Orders in the Previous Year = CALCULATE([Multi Origin Order Count],
FILTER(DimDate, DimDate[Year] = YEAR(TODAY())-1))
Thanks!
User | Count |
---|---|
77 | |
77 | |
36 | |
30 | |
28 |
User | Count |
---|---|
106 | |
97 | |
55 | |
49 | |
46 |