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.
Good day to all,
I am trying to build dynamic time filters: Month to Date, Previous Month, Rolling 12 Months, Year to Date, and Year to Previous Month. I have an issue with the latter only. All of the existing sales data would be shown on the basis of the selected time period.
As I said above, I am struggling with year to previous month end. I have been trying with DATESINPERIOD and DATESINBETWEEN to no avail. Any guidance would be highly appreciated.
Hi, @Giorgi1989 ;
Sometimes when DATESINPERIOD and DATESINBETWEEN do not work, you can use similar statements instead.
filter(all('date'),Year([date])=Year(max('date'[date]))&&month([date])<month(max('date'[date]))
Second, your expression addcolumn is a table measure. If you want the same function as the image, as ValtteriN said, use
SWITCH(Max (),"Previous", if(condition, 1,0)...
Set filter in this Visual to 1.
If not resolved, can you provide more information about your table structure and expected output results?
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
I am not completely sure I understood what you are trying to do but nevertheless here is DAX that returns 1 if [Date] column is between the first day of this year and last day of previous month and else it returns 0. So just replace 1 with "YTD" and 0 with "Selection" and you should achieve what I understood you are trying to achieve. After you have this column it should be pretty straightforward to make a new table from this column (if that is what you want to do).
Proud to be a Super User!
Hi Valtteri,
Thank you for the reply.
I have updated my original post to provide some context.
I see, In that case my previous suggestion should work since it return values for 1.1.2021-30.11.2021.
Proud to be a Super User!
I fully akcknowledge that my original post was not detailed enough to fully express my needs or wishes, for which I do apologise. I will give it another try here:
The formula I currently have:
Then I use the chiclet slicer to filter data across all different categories, which looks like this:
These are all working great, and filter data as expected.
However, despite my various attempts, I still don't seem to get the 'Year to Previous Month' formula working.
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 |
---|---|
49 | |
26 | |
21 | |
15 | |
12 |
User | Count |
---|---|
57 | |
49 | |
44 | |
19 | |
18 |