The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi,
I have a data like in the table below:
...
On my chart I want to get data like in the table below:
1. I want to show only values where the sum > 0
2. Divide the sum/total to present the result as a contribution
Right now I have only DAX which helps me get the elements where the value is bigger than zero:
CALCULATE(SUM('Table'[Measure]),
FILTER(ALL('Table'[Measure]),
SUM('Table'[Measure]) > 0))
Could you help me with this, please?
Thank you in advance!
Solved! Go to Solution.
Hi @lokosrio ,
Refer:
sum if>0 =
VAR sum_by_dim2 =
CALCULATE ( SUM ( 'Table'[Measure] ), ALLEXCEPT ( 'Table', 'Table'[Dim2] ) )
RETURN
IF ( sum_by_dim2 > 0, sum_by_dim2 )
result =
VAR total =
CALCULATE (
SUM ( 'Table'[Measure] ),
FILTER ( ALL ( 'Table' ), [sum if>0] > 0 )
)
RETURN
DIVIDE ( [sum if>0], total )
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @lokosrio ,
Refer:
sum if>0 =
VAR sum_by_dim2 =
CALCULATE ( SUM ( 'Table'[Measure] ), ALLEXCEPT ( 'Table', 'Table'[Dim2] ) )
RETURN
IF ( sum_by_dim2 > 0, sum_by_dim2 )
result =
VAR total =
CALCULATE (
SUM ( 'Table'[Measure] ),
FILTER ( ALL ( 'Table' ), [sum if>0] > 0 )
)
RETURN
DIVIDE ( [sum if>0], total )
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@lokosrio , you have try like
divide(sum(Table[measure]),calculate(sum(Table[measure]), all(Table[dim])))
or
divide(sum(Table[measure]),calculate(sum(Table[measure]), allselected(Table[dim])))
Unfortunately it is not working, because in the calculation I need to filter only values where the sum is greater than 0. In your calculation I am taking all values, which is not the case here
User | Count |
---|---|
65 | |
60 | |
55 | |
54 | |
31 |
User | Count |
---|---|
180 | |
88 | |
70 | |
46 | |
46 |