I am having difficulty to calculate Totals correctly in my virtual table . Here is my code. Individual rows comes correctly. I put 6 over there to make a sense.
I just need to count a column to get value of 3,960,891.
I tried HasOneFilter as well but not sure, what to write on the second half of the IF statement?
New Measure Numerator = VAR __summarytable = ADDCOLUMNS ( SUMMARIZE ( 'Sales Order Detail', Retailer[Retailer AB Number] ), "@Total", CALCULATE ( SUM ( 'Sales Order Detail'[Custom Quantity] ), 'Order Type'[Order Type Transaction Group] = "Sales" ), "@Brand Product Line Return Flag", IF ( ISBLANK ( [Return/Dump Quantity] ), "NO", "YES" ) ) VAR __total = SUMX ( __summarytable, [@Total] ) VAR __returnstotal = IF ( HASONEFILTER ( 'Product'[Product Marketing Brand] ), SUMX ( FILTER ( __summarytable, [@Brand Product Line Return Flag] = "YES" ), [@Total] ), 6 ) RETURN __returnstotal