The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
Is there anyone who can help? I am trying to work out how I could create the 'Desc' column below so that it can be used in a slicer. The fields pane shows that the 'Desc' column is somewhat a column created by DAX in a calculated column. I am assuming this because there is no SUM symbol like Index Dexc and Index has.
The 'Desc' column has been created from the 'Period' column. For example, 'W1 2019' would be selected as 'W' in the slicer. '2021' would be 'Y' and 'Jan 2019' would be 'M'. See pic below.
The above pic are not from my pbix file I am working on. They are from online. I am trying to replicate this:
Thank you.
Solved! Go to Solution.
Hi,
According to your description, I can roughly understand your requirement, I think you can try this DAX formula to achieve your requirement:
You can create the calculated column [Desc] like this:
Desc =
IF(
NOT(ISERROR(VALUE(LEFT('Slicer'[Period]))+1)),"Y",
IF(
NOT(LEFT('Slicer'[Period],1) in {"Q","W"}),"M",
LEFT('Slicer'[Period],1)))
And you can get what you want, like this:
You can download my test pbix file below
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
According to your description, I can roughly understand your requirement, I think you can try this DAX formula to achieve your requirement:
You can create the calculated column [Desc] like this:
Desc =
IF(
NOT(ISERROR(VALUE(LEFT('Slicer'[Period]))+1)),"Y",
IF(
NOT(LEFT('Slicer'[Period],1) in {"Q","W"}),"M",
LEFT('Slicer'[Period],1)))
And you can get what you want, like this:
You can download my test pbix file below
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @matrix_user
Can you share a sample of your data table in a text format?
BTW, try this code to add a new column with dax:
New Column =
VAR _RW =
RIGHT ( Table[Period], 1 )
RETURN
IF ( _RW = "W", "W", IF ( _RW = 2, "Y", "M" ) )
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
Sample I am trying to replicate
https://www.dropbox.com/s/je57x1drgndidmk/Dynamic%20Slicer.pbix?dl=0
My sample work
https://www.dropbox.com/s/8tq9iqnrkulm5t9/ScooterWorld.pbix?dl=0
User | Count |
---|---|
25 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
32 | |
12 | |
10 | |
10 | |
9 |