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.
Here is a Power Bi Report. Can someone create a measure I can use as a filter to show the last 3 years for any customer. Customers are selected from Slicer on Selection Page which populates Page 1 columns.
https://drive.google.com/file/d/1icSIA3aShqN3Ddb2p5WFO2vManfgfJhu/view?usp=drive_link
Solved! Go to Solution.
Here is the File that I did get to work. I took Last3YearsFilter below and put it in ChatGPT and got the measure corrected.
https://drive.google.com/file/d/104cWzIh7ei2zwQzFjXR1LkFAy6odeE7X/view?usp=sharing
Hi,
I cannot understand your question. Show the expected result very clearly.
Here is the File that I did get to work. I took Last3YearsFilter below and put it in ChatGPT and got the measure corrected.
https://drive.google.com/file/d/104cWzIh7ei2zwQzFjXR1LkFAy6odeE7X/view?usp=sharing
Sorry it should be this file. https://drive.google.com/file/d/12ndhq72lIESoi2t4kA4uo02k0weMwaaG/view?usp=sharing
I have not received a valid measure yet.
@bdehning Hey,
you can use below measure
Last3YearsFilter =
VAR MaxYear = MAX(CustomerTable[Year]) -- Get the maximum (most recent) year selected or available
VAR Last3Years = MaxYear - 3 -- Calculate the year that is 3 years before the most recent year
RETURN
IF (
CustomerTable[Year] >= Last3Years && CustomerTable[Year] <= MaxYear, -- Filter for the last 3 years
1, -- Return 1 if the year is within the last 3 years
0 -- Return 0 otherwise
)
If you use aboce measure then you will get 3 year worth record when you select 1 in filter.
Thanks
Harish M
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query
I put this in as Measure
Hi @bdehning - as per the shared pbix file, there is no last three years data. i have created a measure plesae check added in visual filter too.
Proud to be a Super User! | |
That is why I need a measure. There is 3 years or more of data but most are not within the last 3 calendar years.
User | Count |
---|---|
81 | |
74 | |
42 | |
30 | |
28 |
User | Count |
---|---|
108 | |
96 | |
53 | |
48 | |
47 |