Forum Discussion
Incorrect Measure Total
- 8 years ago
Hi,
The SUMX() portion of the formula should be something like this
=SUMX(SUMMARIZE(VALUES(Rebates[Account/Group]),[Account/Group],"ABCD",SUM(Sales value final)*AVERAGE(Rebates[% turnover])),[ABCD])
Include the curency symbol in the underlines portion.
If this formula does not help, then share the link from where i can download your PBI file.
Hi,
I am expecting for the "Total" to display the sum of the values in the column. Can anyone help me with this please?
Formula is,
Zero availability =
var A = SUMX (
agg_bb_sku_oos_daily,
CALCULATE (
DISTINCTCOUNT ( agg_bb_sku_oos_daily[source_sku_id] ),
agg_bb_sku_oos_daily[oos_in_hours_range] = "Zero Availability"
))
var B = CALCULATE(DISTINCTCOUNT(agg_bb_sku_oos_daily[sku_oos_date]),GROUPBY(agg_bb_sku_oos_daily,agg_bb_sku_oos_daily[source_sku_id]),agg_bb_sku_oos_daily[sku_oos_date])
return
A/B
| source_sku_id | sku_oos_date | oos_in_hours_range | Volume | Zero Availability | Var1 | Var2 |
| SKU1 | 1/8/2019 | Zero Availability | 100.00 | 1 | 1 | 1 |
| SKU2 | 1/8/2019 | test | 1309.00 | 0 | 6 | |
| SKU2 | 1/9/2019 | Zero Availability | 138.00 | 0.166666667 | 1 | 6 |
| SKU2 | 1/10/2019 | Zero Availability | 20941.00 | 0.166666667 | 1 | 6 |
| SKU2 | 1/11/2019 | Zero Availability | 214.00 | 0.166666667 | 1 | 6 |
| SKU2 | 1/12/2019 | Zero Availability | 234.00 | 0.166666667 | 1 | 6 |
| SKU2 | 1/13/2019 | Zero Availability | 294.00 | 0.166666667 | 1 | 6 |
| Total | 1 | 6 | 6 |
Hi,
Please explain the business question and show the expected result.
- Anonymous6 years agoNot applicable
Hi Ashish,
We have a measure "Zero Availability" which gets calculate using logic (table data provided in above comments), This returns row-wise correct values but at the total we would expect to see summation of row values. As shown in previous comments DAX will do again calculation (row context) and returning result as "1" but what we expect is "1.8333" which is row values SUM.
Var 1 = SUMX ( agg_bb_sku_oos_daily, CALCULATE ( DISTINCTCOUNT ( agg_bb_sku_oos_daily[source_sku_id] ), agg_bb_sku_oos_daily[oos_in_hours_range] = "Zero Availability" ) ),Var 2 = CALCULATE ( DISTINCTCOUNT ( agg_bb_sku_oos_daily[sku_oos_date] ), GROUPBY ( agg_bb_sku_oos_daily, agg_bb_sku_oos_daily[source_sku_id] ), agg_bb_sku_oos_daily[sku_oos_date] ))Zero Availability = Var 1/ Var 2I have used below formula to get the correct results at the "Total" but, Performance is degraded as it is iterating for each rows. Is there any alternative approach which doesn't impact performance as well?RowValues = DIVIDE (SUMX ( agg_bb_sku_oos_daily, CALCULATE ( DISTINCTCOUNT ( agg_bb_sku_oos_daily[source_sku_id] ), agg_bb_sku_oos_daily[oos_in_hours_range] = "Zero Availability" ) ),, CALCULATE ( DISTINCTCOUNT ( agg_bb_sku_oos_daily[sku_oos_date] ), GROUPBY ( agg_bb_sku_oos_daily, agg_bb_sku_oos_daily[source_sku_id] ), agg_bb_sku_oos_daily[sku_oos_date] )))Zero Availability = VAR __table =SUMMARIZE ( 'agg_bb_sku_oos_daily', [source_sku_id], "__value", [RowValues] )RETURN
IF (HASONEVALUE ( agg_bb_sku_oos_daily[source_sku_id] ),[RowValues],SUMX( __table, [__value] ))- Ashish_Mathur6 years agoSuper User
Hi,
Share the link from where i can download your PBI file.
- Anonymous6 years agoNot applicable