March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Dear all,
My issued is I would like to give Customer rate by sale value
Example data
Customer , Customer-Type , SaleValue , Month
A , Small , 1000 , January
A , Small , 2000 , February
B , Big , 2500 , January
B , Big , 3500 , February
I would likre return column like this :-
Customer , Customer-Type , SaleValue , RateValue
A , Small , 3000 , Good
B , Big , 4500 , Very Good
From 2 group condition :-
1.Customer-Type ="Small" -: if SaleValue < 1000 = "Low , if SaleValue >=1000 and <2000 then "Average" , if SaleValue>=2000 then "Good"
2.Customer-Type ="Big" :- if SaleValue < 1500 = "Low , if SaleValue >=1500 and <2500 then "Average" , if SaleValue>=2500 and SaleValue<3500 then "Good" , if SaleValue>=3500 then"Very Good"
I can not find any solution , please give me any idea, thank you in advance.:-)
Solved! Go to Solution.
Hi @PowerBi888
You can use SWITCH TRUE to achieve this:
Measure =
VAR _1 = SUM ( Table[SaleValue] )
VAR _Small =
SWITCH (
TRUE () ,
_1 < 1000 , "Low" ,
_1 < 2000 , "Average" ,
_1 < >2000, "Good" )
VAR _Big =
SWITCH (
TRUE () ,
_1 < 1500 , "Low" ,
_1 < 2500 , "Average" ,
_1 < 3500, "Good"
_1 < 3500, "Very Good")
RETURN
IF ( Table[Customer-Type] = "Small" , _Small, _Big )
I haven't tested syntax but hopefully it works fine.
Theo 🙂
If I have posted a response that resolves your question, please accept it as a solution to formally close the post.
Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!
Want to connect?www.linkedin.com/in/theoconias
@PowerBi888 a new column won't work. However you should be able to create a new table (even if you use Enter Data to achieve this). then, you can create relationship between the new table column and the Calculated Column. Then just drag new column (from new table) as slicer.
Hope this helps.
If I have posted a response that resolves your question, please accept it as a solution to formally close the post.
Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!
Want to connect?www.linkedin.com/in/theoconias
Hi TheoC,
Now I got it and solved above. I have one question if I would like to create Slicer for select value--> "Low" , "Average" How can I use Slicer for measure?
Hi @PowerBi888
Okay, create a calculated column that applies the same logic as the measure I created earlier using the below:
New Calculated Column =
VAR _1 = CALCULATE ( SUM ( Table[SaleValue] ) , ALLEXCEPT ( 'Table' , Table[Customer] ) )
VAR _Small =
SWITCH (
TRUE () ,
_1 < 1000 , "Low" ,
_1 < 2000 , "Average" ,
_1 < >2000, "Good" )
VAR _Big =
SWITCH (
TRUE () ,
_1 < 1500 , "Low" ,
_1 < 2500 , "Average" ,
_1 < 3500, "Good"
_1 < 3500, "Very Good")
RETURN
IF ( Table[Customer-Type] = "Small" , _Small, _Big )
Where the above works as a column, then all you do is drag "New Calculated Column" as the slicer.
Hope this helps 🙂
Theo
If I have posted a response that resolves your question, please accept it as a solution to formally close the post.
Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!
Want to connect?www.linkedin.com/in/theoconias
@PowerBi888 off the top of my head, you'll need to put together a new table with the values in a column (ie low, avg, good, v good). I'll reply this morning when in front of computer. I just want to test to make sure.
If I have posted a response that resolves your question, please accept it as a solution to formally close the post.
Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!
Want to connect?www.linkedin.com/in/theoconias
Hi TheoC,
I try with new formula with column calculate value ,but it's not work. Error show look like "A circular dependency was detected in : New Column.
No idea to solved this issued.
@PowerBi888 a new column won't work. However you should be able to create a new table (even if you use Enter Data to achieve this). then, you can create relationship between the new table column and the Calculated Column. Then just drag new column (from new table) as slicer.
Hope this helps.
If I have posted a response that resolves your question, please accept it as a solution to formally close the post.
Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!
Want to connect?www.linkedin.com/in/theoconias
Hi TheoC,
I try create new table with new Column rate, but I can not create relation new column with existing measure. How can I do?
Thank a lot .
Hi TheoC,
Now I got solution filter-->
Power BI Filter by a Measure in a Slicer from youtube (BI Elite)
Thank you & hope help to others.
Hi @PowerBi888
You can use SWITCH TRUE to achieve this:
Measure =
VAR _1 = SUM ( Table[SaleValue] )
VAR _Small =
SWITCH (
TRUE () ,
_1 < 1000 , "Low" ,
_1 < 2000 , "Average" ,
_1 < >2000, "Good" )
VAR _Big =
SWITCH (
TRUE () ,
_1 < 1500 , "Low" ,
_1 < 2500 , "Average" ,
_1 < 3500, "Good"
_1 < 3500, "Very Good")
RETURN
IF ( Table[Customer-Type] = "Small" , _Small, _Big )
I haven't tested syntax but hopefully it works fine.
Theo 🙂
If I have posted a response that resolves your question, please accept it as a solution to formally close the post.
Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!
Want to connect?www.linkedin.com/in/theoconias
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
85 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |