Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 216047

IF statement totaling issues

$
0
0

I'm attempting to use IF statements on a measure that calculates properly. With the IF statement measure, the individual line shows the correct amount but the totals do not foot.

 

To illustrate, here is the working formula:

sumx(' account_statement_item',
	countrows(
		filter(ALL_Dates,ALL_Dates[ALL_DATES]>=' account_statement_item'[date_start] && ALL_Dates[ALL_DATES]<=' account_statement_item'[mod_date_end]&& related(' account'[type])<>"internal" && OR(related(' account_statement'[current_status])="paid", related(' account_statement'[current_status])="unpaid")))
	*divide(' account_statement_item'[Line Net Revenue],iferror(datediff(' account_statement_item'[date_start],' account_statement_item'[mod_date_end],day)+1,0)))

I have another iteration of this where it just moves the dates back a month in order to calculate the change. This also works fine.

VAR LastMonth = PARALLELPERIOD(ALL_Dates[ALL_DATES],-1,MONTH)
RETURN

But... when I run this, it does not properly sum the total even though it appears to be calculating correctly on each row.

Upsells = if([Sales]-[Sales LastMonth]>0, [Sales]-[Sales LastMonth],0)

Attached is a screenshot with a red circle around the measure above and $0 total. The last column is a measure that simply takes [Sales] - [Sales LastMonth]. The end goal is to show the components of change - which lines had positive increases vs. which ones had decreases and put them in respective buckets.


Viewing all articles
Browse latest Browse all 216047

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>