Forum Discussion
Anonymous
3 years agoNot applicable
DAX filter not working
I am trying to display the number of customers that fall within each revenue range. This is the code I have right now. However, the filter does not seem to be working. Rev Range = SWITCH ( ...
Anonymous
3 years agoNot applicable
Hello DimaMD ,
Thanks for your help! I applied the codes and it works.
Just one issue I am facing is one of my ranges are missing when I apply Amount raw/ Amount raw total.
Also, for better personal understanding, can I just check that I have understood the codes below correctly?
// Add new column (segment) in the consolidated table that allocates a revenue range to each transaction
Amount raw =
VAR _CustomerSegments =
ADDCOLUMNS(
VALUES('Raw data'[CustID]),
"Segment", [Rev Range]
)
// Count number of customers for each group in the new segment column that have data. Also can I ask what is # Customers?
VAR _SegmentCustomerCount =
GROUPBY(
_CustomerSegments,
[Segment],
"# Customers", COUNTX ( CURRENTGROUP (), 1 )
)
// For each segment, filter for each range
VAR _Result =
FILTER(
_SegmentCustomerCount,
[Segment] = SELECTEDVALUE('Range table'[Range])
)
RETURN
MAXX(
_Result,
[# Customers]
)
DimaMD
Solution Sage
3 years agoAnonymous Hi, in my reports we counted the number of my customers and called this virtual column "# Customers"
Which of the ranges is not displayed for you? you have to give an example.
Also check the correct spelling of the condition, maybe there is an error somewhere, it may be banal spelling, you missed a space or some symbol