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.
Hello All,
I want to filter with rating as per below
Total Sales < 8000 = 1
Total Sales 8000 to 10000 = 2
Total Sales > 10000 = 3
I have created new column with follwing filter and it is not working.
------------
Measure =
VAR FilteredPrice =
CALCULATE ( SUM ( Trans[Price.PRICE] ), ALLEXCEPT ( Trans, Trans[CUSTNUM1] ) )
RETURN
SWITCH (
TRUE (),
FilteredPrice < 8000, "1",
FilteredPrice > 8000
&& FilteredPrice < 10000, "2",
// default case
"3"
)
Christopher Pollock @ LinkedIn
If this post helps please consider "Accept it as the solution" to help the other members find it more quickly.
⚡Vist us at https://www.bireel.com/ for courses, development and consulting purposes⚡
@Anonymous , see you are lloking for segmentation , refer
https://www.daxpatterns.com/dynamic-segmentation/
https://www.daxpatterns.com/static-segmentation/
https://www.poweredsolutions.co/2020/01/11/dax-vs-power-query-static-segmentation-in-power-bi-dax-power-query/
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization
HI @Anonymous ,
Try this measure
Measure =
var a = CALCULATE(SUM(Trans[Price.PRICE]),ALLEXCEPT(Trans,Trans[CUSTNUM1]
RETURN
SWITCH(
TRUE(),
a >= 10000, "3",
a <10000 && a >= 8000 ,"2",
"1"
)
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Hi @Anonymous
try SWITCH()
Measure =
var _SumPrice = CALCULATE(SUM(Trans[Price.PRICE]),ALLEXCEPT(Trans,Trans[CUSTNUM1]) )
RETURN
SWITCH(TRUE(),
_SumPrice < 8000 , "1",
_SumPrice > 8000 && _SumPrice < 10000, "2",
"3"
)
When you say "and it's not working", just what is it doing ?
You might consider creating a "helper measure"
Calc_Total = CALCULATE(SUM(Trans[Price.PRICE]),ALLEXCEPT(Trans,Trans[CUSTNUM1])
and put that in your table and see if it's returning the answers you expect.
If so, you can use it to calculate your column.
If you are interested in turning your 3 categories into a slicer, you could use the "parameter table" pattern https://www.daxpatterns.com/parameter-table/
Help when you know. Ask when you don't!
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 |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |