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! I am struggling with creating a dax to sum the results returned by a measure considering only its positive values
So I have few tables with the following columns:
Fact_Sales: [Material] [Unit] [Operational_Cat] [Store] [Sales]
dim_Material: [Material] [Operational_Cat]
dim_Operational_Cat: [Operational_Cat]
dim_Stores: [Store]
dim_benchmark_Store: [Store]
dim_unit: [Unit]
And the modeling is as follows:
I created a few simple measures for the sum of sales:
Results are correct and I'm later filtering my matrix to only show positive values (because negative value has no meaning to me)
The matrix is as follows:
Problem is that for sub-totals I do not want the measure to sum the negative values .. I want the sub-total per company and per operational category (possibly with HASONEVALUE) to only sum the positive values returned by the POTENTIAL REVENUE measure, but I can't filter the measure results to only consider positive value (I can filter the matrix but the sub-total still sums the negative values)
Help will be appreciated!! This is a common problem that I can't solve
Someone who gives lectures on power bi helped me to find a solution
He used a var inside a return statement to set a fixed denominator, first time I see a loop within a return statement
Hi @MichaelStrauss ,
I suggest you to create a new measure based on [Portential Revenue] and add some filter on it. I think you use [Operational_Cat]/[Material]/[Unit] as three hierachy levels in matrix.
SUM WITHOUT NEGATIVE =
SUMX (
FILTER (
SUMMARIZE (
'Fact_Sales',
'Fact_Sales'[Operational Cat],
'Fact_Sales'[Unit],
'Fact_Sales'[Material]
),
[Potential Revenue] >= 0
),
[Potential Revenue]
)
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for your answer
I've tried your solution but unfortunately it does not do as requested
Instead of summing just positive values what it does is calculating the measure Potential_Revenue with the other sub-total measure values. Meaning that if the calculation of the sub-total row level is less then 0 it returns blank, and if it's above 0 it just uses the row context and rather than sum up the previous hierarchy level values
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 |
---|---|
108 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |