Forum Discussion
Need a DAX measure to replace an Excel function.
- 7 years ago
Hi there,
I wish everyone was as clear in describing their needs! :)I think the below will help you.
I simply created the running total for both columns, devided it and *1000.Calc = DIVIDE( CALCULATE( SUM('Table'[Number of Complaints]); FILTER( ALLSELECTED('Table'[Month]); ISONORAFTER('Table'[Month]; MAX('Table'[Month]); DESC) ) ); CALCULATE( SUM('Table'[Number of Key Transactions]); FILTER( ALLSELECTED('Table'[Month]); ISONORAFTER('Table'[Month]; MAX('Table'[Month]); DESC) ) ) )*1000Hope this helps.
Hi,
Strange,
Please have a look here:
I seem to get the correct result? ...
make sure you adjusted my measure correctly.
robbe
Hi RobbeVL
Your code:
Calc =
DIVIDE(
CALCULATE(
SUM('Table'[Number of Complaints]);
FILTER(
ALLSELECTED('Table'[Month]);
ISONORAFTER('Table'[Month]; MAX('Table'[Month]); DESC)
)
); CALCULATE(
SUM('Table'[Number of Key Transactions]);
FILTER(
ALLSELECTED('Table'[Month]);
ISONORAFTER('Table'[Month]; MAX('Table'[Month]); DESC)
)
)
)*1000My code:
Calc2 =
DIVIDE(
CALCULATE
(SUM('All_Complaints'[count]),
FILTER(
ALLSELECTED('Date_Table'[Month]),
ISONORAFTER(Date_Table[Month],MAX(Date_Table[Month]), DESC)
)
), CALCULATE(
SUM('Total_key_Transactions'[Total Key Transactions]),
FILTER(
ALLSELECTED(Date_Table[Month]),
ISONORAFTER(Date_Table[Month],MAX(Date_Table[Month]),DESC)
)
)
)*1000My complaints figures [count] are daily volumes, whereas yours [Number of Complaints] are monthly volumes. Unsure if that is causing the problem. If so, how can i get arounfd this?
- RobbeVL7 years agoImpactful Individual
Indeed!
Change month to the lowest date hierarchy and this should be fine.
every month can be "date"- PaulMac7 years agoHelper IV
RobbeVL wrote:Indeed!
Change month to the lowest date hierarchy and this should be fine.
every month can be "date"
"Change month to the lowest date hierarchy" I am unsure how to do this. Any chance of some assitance?- RobbeVL7 years agoImpactful Individual
Make sure your relationships are defined corretly.
Another way to fix your problem, will be to use the datekey in your FACT Table.
so use DATE in the measure as the datefield in the same table.