Forum Discussion
Need help with a basic new measure
I'm trying to create a basic new measure (subtraction of values in one column from another but it's not working. I have two columns, Previous Month and Current Month. I need to create a new measure (Variance) which shows the increase or decrease in counts, see example below. The reason I need a new measure is in order to use field values in conditional formatting.
Previous Month Current Month Variance
100 250 150
100 50 -50
10 10 0
hi Rnaval
can you tell us what exactly the error is?
below dax should be able to calculate the difference:
Variance = SUM('YourTable'[Current Month]) - SUM('YourTable'[Previous Month])OR
Variance =
SUMX(
'YourTable',
'YourTable'[Current Month] - 'YourTable'[Previous Month]
)
Check the datatype if this does not work.My Work:
Analytic Pulse Blog
Docynx Productivity Tools
Generate Realistic Sample Data Instantly online
3 Replies
- AnalyticPulseSolution Sage
hi Rnaval
can you tell us what exactly the error is?
below dax should be able to calculate the difference:
Variance = SUM('YourTable'[Current Month]) - SUM('YourTable'[Previous Month])OR
Variance =
SUMX(
'YourTable',
'YourTable'[Current Month] - 'YourTable'[Previous Month]
)
Check the datatype if this does not work.My Work:
Analytic Pulse Blog
Docynx Productivity Tools
Generate Realistic Sample Data Instantly online- RnavalPost Partisan
I used the following - Variance = SUM('YourTable'[Current Month]) - SUM('YourTable'[Previous Month]) and that works but under conditional formatting, the only option that works is the "=" option, I need the < and the > options which are not available.
- RnavalPost Partisan
Actually, I was able to get it working by using the if and clauses creatively and achived the desired results