Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
Hi,
I have a table as below.
| Customer | Brand | Sales | Measure |
| a | TT | 2 | =(2/(2+3+5+1) |
| b | TT | 3 | =(3/(2+3+5+1) |
| c | TT | 5 | =(5/(2+3+5+1) |
| d | TT | 1 | =(1/(2+3+5+1) |
| e | TC | 6 | =(6/(6+4) |
| f | TC | 4 | =(4/(6+4) |
Measure=divide(calculate(sum(sales),filter(table_1,customer=customer)),calculate(sum(sales),filter(table_1,brand=brand)))
however, when I create a table for customer
| Customer | Measure |
| a | 1 |
| b | 1 |
| c | 1 |
| d | 1 |
| e | 1 |
| f | 1 |
so how I fixed it
Solved! Go to Solution.
Hi, @selpaqm
Try to create a measure like this:
__Measure =
VAR _customer =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Customer] = MAX ( 'Table'[Customer] )
)
)
VAR _brand =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Brand] = MAX ( 'Table'[Brand] ) )
)
RETURN
DIVIDE ( _customer, _brand )
result:
It is recommended to use percentage formatting, otherwise you will only see 0 or 1
Please refer to the attachment below for details
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
measure1:
__divide =
var _customer=CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),'Table'[Customer]=MAX('Table'[Customer])))
var _brand=CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[Brand]=MAX('Table'[Brand])))
var _divide=DIVIDE(_customer,_brand)
return _divide
measure2:
_result =
VAR _sum =
SUMMARIZE ( 'Table', [Customer], [Brand], [Sales], "1", [__divide] )
RETURN
SUMX ( _sum, [1] )
result:
Best Regards,
Community Support Team _ Zeon Zheng
Hi, @selpaqm
Try to create a measure like this:
__Measure =
VAR _customer =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Customer] = MAX ( 'Table'[Customer] )
)
)
VAR _brand =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Brand] = MAX ( 'Table'[Brand] ) )
)
RETURN
DIVIDE ( _customer, _brand )
result:
It is recommended to use percentage formatting, otherwise you will only see 0 or 1
Please refer to the attachment below for details
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-angzheng-msft thanks for reply works on table. when using a filter on slicer. it shows as 100% again. is there any solution for it? also total is not correct.
measure1:
__divide =
var _customer=CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),'Table'[Customer]=MAX('Table'[Customer])))
var _brand=CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[Brand]=MAX('Table'[Brand])))
var _divide=DIVIDE(_customer,_brand)
return _divide
measure2:
_result =
VAR _sum =
SUMMARIZE ( 'Table', [Customer], [Brand], [Sales], "1", [__divide] )
RETURN
SUMX ( _sum, [1] )
result:
Best Regards,
Community Support Team _ Zeon Zheng
@selpaqm Try:
Measure=divide(calculate(sum(sales),filter(ALL(table_1),customer=customer)),calculate(sum(sales),filter(ALL(table_1),brand=brand)))
@selpaqm , Try a measure like
divide(sum(table[Sales]), calculate(sum(table[Sales]), filter(allselected(Table), Table[Brand]= max(Table[Brand]))))
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 63 | |
| 62 | |
| 42 | |
| 19 | |
| 16 |
| User | Count |
|---|---|
| 118 | |
| 106 | |
| 38 | |
| 28 | |
| 27 |