Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

CALCULATE returns 0 on DATE column

Dear Guys,

 

I got the request to build two tables. Left-hand side is the count some columns by date and right-hand side is difference between two consequtive months. It looks very good by this solution: PowerBI: Stacked Column Chart using only measures | LinkedIn

Then, I need to reorder the date column in descending order. Let's say that the current date should be the first column. So, I applied this Quick Tips: How to Sort Matrix by Column in Descending Order (biinsight.com) as Reversed RUN_DATE. On the left-hand side table is good, but on the right is not since the CALCULATE logic returns 0 on the calculation for previous month. 

Noted that the value for right-hand side is Switch Measure Trend. Basically, just compute diffrence between two months.

 

As a result, these two tables are the same. However, if I show the previous date, it can compute correctly.

 

Eventaully, right-hand side table should be difference between two months and column in matrix should be shown in descending order. Do you guys have any suggestions on this?

1 Reply