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.
Hi All,
this is probably very simple but have not found it online or atleast the searches I have are not right.
I have a sales target of lets say 100 and and within that 100 are categories - example cars 50 and bikes 50
I get a percentage out of 100 which is fine but when I filter down to categories the dax below will still use 100 as the denominator. I want to be able to filter to cars or bikes and the sales amount to be calculated against the target number for that category
any idea on what I can put in to enable me to filter to different categories
Solved! Go to Solution.
@Jitmondo , try like
Target % = calculate(Divide('salestable'[salessum], calculate('targettable'[targetsum], allselected() ) ) )
or
Target % = calculate(Divide('salestable'[salessum], calculate('targettable'[targetsum], all() ) ) )
Hi @Jitmondo
You can try this, create the measure below
Target % =
VAR _category =
SELECTEDVALUE ( Slicer[categories] )
VAR _salessum =
CALCULATE (
SUM ( salestable[sales] ),
FILTER ( ALL ( salestable ), salestable[categories] = _category )
)
VAR _targetsum =
CALCULATE (
SUM ( targettable[target] ),
FILTER ( ALL ( targettable ), targettable[categories] = _category )
)
RETURN
IF (
ISBLANK ( _category ),
'salestable'[salessum] / 'targettable'[targetsum],
_salessum / _targetsum
)
result
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hi @Jitmondo
You can try this, create the measure below
Target % =
VAR _category =
SELECTEDVALUE ( Slicer[categories] )
VAR _salessum =
CALCULATE (
SUM ( salestable[sales] ),
FILTER ( ALL ( salestable ), salestable[categories] = _category )
)
VAR _targetsum =
CALCULATE (
SUM ( targettable[target] ),
FILTER ( ALL ( targettable ), targettable[categories] = _category )
)
RETURN
IF (
ISBLANK ( _category ),
'salestable'[salessum] / 'targettable'[targetsum],
_salessum / _targetsum
)
result
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
@Jitmondo , try like
Target % = calculate(Divide('salestable'[salessum], calculate('targettable'[targetsum], allselected() ) ) )
or
Target % = calculate(Divide('salestable'[salessum], calculate('targettable'[targetsum], all() ) ) )
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 |
---|---|
113 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |