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.
Hi Team, I have an requirement to filter the data for previous year(12 months)+ current year (till the date). Basically i want display total completed count in my table every month wise and always it should be display full year(2021)+ current date(till date) when i filter this on my visual level then it should filtering the data. so please let me know how can i achieve this.
Solved! Go to Solution.
Hi @sreddy47652 ,
Please try the measure.
flag =
VAR CurYear =
YEAR ( TODAY () )
RETURN
IF ( YEAR ( MAX ( 'Table'[Date] ) ) IN { CurYear, CurYear - 1 }, 1, 0 )
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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 sure if I understood your question correctly, but please check the below picture and the attached pbix file.
I tried to create a sample pbix file like below, and I hope the below measure helps to create suitable measure for your data model.
Expected result measure: =
VAR _condition =
CALCULATE ( SUM ( Data[Value] ), PARALLELPERIOD ( 'Calendar'[Date], -1, YEAR ) )
&& SUM ( Data[Value] )
RETURN
IF (
_condition,
CALCULATE ( SUM ( Data[Value] ), DATESYTD ( 'Calendar'[Date] ) )
+ CALCULATE ( SUM ( Data[Value] ), PARALLELPERIOD ( 'Calendar'[Date], -1, YEAR ) )
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
@Jihwan_Kim , Thanks for your time and do the above one. My requirement is same but i need some flag value(1,0) based on that i can filter out current year and previous year becacuse already i have calucaltions for previous year and last year but when we have lot of years on my date column i want to display always previous year(12 months)+till date. when we have some kind of flag value i can filter out on visual level.
Hi @sreddy47652 ,
Please try the measure.
flag =
VAR CurYear =
YEAR ( TODAY () )
RETURN
IF ( YEAR ( MAX ( 'Table'[Date] ) ) IN { CurYear, CurYear - 1 }, 1, 0 )
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@sreddy47652 , If date is selected
YTD= CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year]>=max('Date'[Year])-1 && 'Date'[Year]<=max('Date'[Year]) && 'Date'[Day of Year] <= Max('Date'[Day of Year]) ))
column
Day of Year =datediff([Year Start date] , [Date],Day) +1
Using today
YTD Today=
var _min = date(year(today())-1 ,1,1)
var _day = today()
return
CALCULATE(sum('Table'[Qty]), FILTER(('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _day) )
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 |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |