Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Month over Month

Hello I am trying to show a month by month comparison betweeen total views. I have been looking at youtube and this channel as well for answers and im not sure if I dont have enough data or what exactly I am doing wrong. I only have 3 months worth of data so maybe thats my issue 

I started out with just one dataset "data" which has a column of "Total Views"

My first attempt i did:

 

tv = SUM(data[Total Views])
 
total views last month =
CALCULATE(
[tv],
PARALLELPERIOD(
'data'[Date].[Date],
-1,
MONTH)
)

but i just get the exact same number for that month when trying to graph it ot show it in a table
Screenshot_46.jpg
also tried this code:
total by month LM = CALCULATE(SUM(data[Total Views]),DATEADD(data[Date].[Date],-1,MONTH))
 
but gives me the same results 
Screenshot_47.jpg
 
The end goal would be to have a bar chart that would show the difference between the current month and past month 

also tried 

PrevMonthRev = CALCULATE(sum(data[Total Views]),PREVIOUSMONTH('data'[Date].[Date]))
but thats not even giving me any numbers 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

I tried this and it worked on my side:

PrevMonthRev = CALCULATE(sum(data[Total Views]),PREVIOUSMONTH('data'[Date].[Date]))

You may simply use this:

total by month LM = CALCULATE(SUM('data'[Total Views]),PARALLELPERIOD ( 'data'[Date].[Date], -1, MONTH ))

Here is the final output:

Eyelyn9_1-1632968155219.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

I tried this and it worked on my side:

PrevMonthRev = CALCULATE(sum(data[Total Views]),PREVIOUSMONTH('data'[Date].[Date]))

You may simply use this:

total by month LM = CALCULATE(SUM('data'[Total Views]),PARALLELPERIOD ( 'data'[Date].[Date], -1, MONTH ))

Here is the final output:

Eyelyn9_1-1632968155219.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Awesome, this works perfectly!! Thank you!!

wdx223_Daniel
Community Champion
Community Champion

CALCULATE(SUM(data[Total Views]),DATEADD(data[Date].[Date],-1,MONTH),ALL(data[Date]))

jwelch
Microsoft Employee
Microsoft Employee

Since this question is on DAX, you would be more likely to get an answer by posting in the DAX forum (DAX Commands and Tips - Microsoft Power BI Community).

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.