Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi to everyone,
I am trying to calculate the count of some elements undependently from the slicer and using a measure for an index.
Basically I have:
- Year (slicer) = 2021
- [MonthUpDate] is a measure that gives the last Month of data collected.
I wouold like to have the count of elements for year 2018 and for the months March.
The solution I guessed is:
The formula is not wring, but I got no elements counted (i.e.: result = null) while in reality I have 14.500 elements in that year/month.
May enyone give some hints?
Thanks in advance
Hi @gunicotra ,
Can you give me some sample data and the results you want to get? Or share me with your pbix file from your Onedrive for Business.
You can create a calendar table and use the date column to create a date slicer to filter month and year.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@gunicotra , if you have date. With help from date table
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
or
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-2,Year))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
Hi amitchandak,
your first answer made me think at a different solution which worked well!
CALCULATE(sum('Table'[Counter]),
filter(all('Table'[YEAR]),'Table'[YEAR]=2018),
DATESINPERIOD('Table'[DATE_IN],[MinDatePY],-30,DAY)
)/4
With [MinDatePY] = DATE(2018,MONTH(NOW()),DAY(NOW())) is a new measure that brings back to 2018
Thus thank you for the hint 😉
Hi Kudos,
unfortunately this did not give the right solution. I still got no error, but "null" as value.
In order to provide more elements I can say that skipping the measure, give the right solution:
However in this case I just applicable to March.
I read that filtering with ALL( column).... should be the right answer to using a measure as index. But I don't understand whiy this is not working in my case.
Thanks
User | Count |
---|---|
122 | |
97 | |
89 | |
77 | |
68 |
User | Count |
---|---|
139 | |
115 | |
114 | |
98 | |
98 |