The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
I have a column that shows the year difference between opening and account and closing the account. I'd like to make a slicer which has the following options
SLICER:
<1 year
1-3 years
3-5 years
>5 Years
Is there a way to create a slicer that could show this?
Solved! Go to Solution.
Hi ,
How about this:
SWITCH (
TRUE,
'Query1'[Year Diff] < 1,"<1",
'Query1'[Year Diff] >= 1 && 'Query1'[Year Diff] <= 3,"1-3",
'Query1'[Year Diff] >= 4 && 'Query1'[Year Diff] <= 5,"4-5",
">5"
)
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Hi @KW123 ,
I'd suggest you add a new column with the logic above to create the bins you need.
Then use that column in your slicer.
Try to create the column as upstream as possible and as downstream as necessary, meaning add the column in the source if possible. If that does not work do it rather in Power Query as in DAX.
Let me know if this helps 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
@KW123 ,
Create a new column with an if statement where you implement your logic like
if table[YearDifference] < 1 then "<1 year" else
if table[YearDifference] >= 1 and table[YearDifference] < 3 then "1-3 years" else
if table[YearDifference] >= 3 and table[YearDifference] < 5 then "3-5 years" else
">5 Years "
Note, the code above is just a pseudo code. You have to google the right syntax yourself depending on whether you are using DAX code or Power Query's M.
Does this help? 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Hi ,
How about this:
SWITCH (
TRUE,
'Query1'[Year Diff] < 1,"<1",
'Query1'[Year Diff] >= 1 && 'Query1'[Year Diff] <= 3,"1-3",
'Query1'[Year Diff] >= 4 && 'Query1'[Year Diff] <= 5,"4-5",
">5"
)
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
19 | |
18 | |
17 | |
15 | |
13 |
User | Count |
---|---|
36 | |
35 | |
20 | |
18 | |
18 |