Forum Discussion
Anonymous
2 years agoNot applicable
Segment
Hi all, I have the following dataset: Month ID Product Amount 1 A-001 X 5 1 A-001 Y 4 1 A-002 X 1 1 A-003 X 10 2 A-001 X 1 2 A-001 Y 4 2 A-002 X 6 ...
- 2 years ago
Hi,
I am not sure how your semantic model looks like, but please try something like below.
Please check the below picture and the attached pbix file.
Sales: = SUM( sales[Amount] )Segment: = VAR _sales = [Sales:] VAR _segment = FILTER ( Segment, Segment[min] <= _sales && Segment[max] >= _sales ) RETURN IF ( HASONEVALUE ( 'ID'[ID] ) && HASONEVALUE ( 'Month'[Month] ), MAXX ( _segment, Segment[Category] ) )
Jihwan_Kim
Super User
2 years agoHi,
I am not sure how your semantic model looks like, but please try something like below.
Please check the below picture and the attached pbix file.
Sales: =
SUM( sales[Amount] )
Segment: =
VAR _sales = [Sales:]
VAR _segment =
FILTER ( Segment, Segment[min] <= _sales && Segment[max] >= _sales )
RETURN
IF (
HASONEVALUE ( 'ID'[ID] ) && HASONEVALUE ( 'Month'[Month] ),
MAXX ( _segment, Segment[Category] )
)