Reputation: 3
We need to plot graph on Power BI where on X axis we have a band and on y axis we have count of customers that fall in this band We have a front end filter having values Type1 , type2, type3 (Note: This filter has multi select option enabled)
When any of the type is selected ,TotalValuebyCustomer(Column D) should be subtracted from the selected type column.
Here is our table:
When Type1 is selected For C01 ColumnD - Column E i.e; 15-5 =10 Band should be 6 to 10 . For C02 ColumnD - Column E i.e; 16-1 =15 Band should be 10+
Graph should show 1 customer in 6 to 10 band and 1 customer in 10+ band
When type2 is selected
For C01 Column D- Column F i.e; 15-10=5 Band should be 1-5
For C02 Column D- Column F i.e; 16-12=4 Band should be 1-5
Graph should show count of 2 customers in 1-5 band
When type3 is selected
For C01 Column D- Column G i.e; 15-13=2 Band should be 1-5
For C02 Column D- Column G i.e; 16-10=6 Band should be 6 to 10
Graph should show 1 customer in 1 to 5 band and 1 customer in 6 to 10 band
When Type 1 and Type2 both are selected
For C01 Column D -[ColumnE + Column F] i.e; 15-(5+10)=0 Band should be 0
For C02 Column D- [ColumnE + Column F] i.e; 16-(1+12)=3 Band should be 1 to 5
Graph should show 1 customer in 0 band and 1 customer in 1 to 5 band
Upvotes: 0
Views: 61
Reputation: 2495
you can try this
then we will have a band table
at last, you need to create a measure
MEASURE =
VAR _list =
DISTINCT ( 'Table'[Attribute] )
VAR _list2 =
DISTINCT ( 'Table'[Category] )
VAR _tbl =
ADDCOLUMNS (
SUMMARIZE (
FILTER ( 'Table', 'Table'[Attribute] IN _list && 'Table'[Category] IN _list2 ),
'Table'[Customer],
'Table'[Category],
'Table'[Total ValuebyCustomer],
"total", SUM ( 'Table'[Value] )
),
"result", [Total ValuebyCustomer] - [total]
)
RETURN
COUNTROWS (
FILTER (
_tbl,
[result] >= MAX ( Band[Left] )
&& [result] <= MAX ( Band[Right] )
)
)
Upvotes: 0