cancel
Showing results for
Did you mean:
Frequent Visitor

## Graph the current Month (day-to-day) with previous Month

Hey there,

First of thanks to the community for their help already. You guys have been awesome!

Now, I am hoping for a solution in a problem that I have just encountered with trying to compare different data over time. I know this has been looked at various times but I was not able to find a fitting solution so far.

1) What I am trying to achieve, is to show Data for the current Month, as well as Data for the previous Month up to the specific date (e.g. January 1 - 26; February 1 - 26 (current month) ). I am using the chicletslicer to slice by Month as shown in the Screenshot. Now, it it possible that todays date is automatically drawn even though i have selected the whole month?

2) Despite getting this up and running what I am also trying to achieve is to have the two values January/Feburary (current month) put into the graph to show the different values ofer a period of the month in a day-to-day view (screenshot). Also, the Values themselve (e.g. 77 & 51 (sum of values for January), are not changing if I choose a bar on the graph.

I am calculating the previous months values with:

Visitors previous month = CALCULATE(SUM('Table'[Visitors]); PREVIOUSMONTH(Datedimension[Date]))

However i am not able to show it on a day-to-day graph which does have to do with the PREVIOSMONTH, but I am not sure what to use here. I have tried to create a Table with:

same period last month = CALCULATE(SUM('GA_Master 1'[Besucher]);DATEADD('GA_Master 1'[Date];-1;MONTH))

But this is not giving me back any values at all.

3) I am trying to show the changes in percentage in color (e.g. Red: Negative, Black: Neutral, Green: Positive). Any suggestions?

Thank you guys in advance for any help!

Kevin

5 REPLIES 5
Microsoft

For 1) how does this measure look?

I think it should return the value for the same Day of the month for the previous month.

```Visitors Last Month =
var Offset = DAY(EOMONTH(LASTDATE('Table'[Date]),-1))

Proud to be a Datanaut!

Frequent Visitor

Hey @Phil_Seamark,

Thanks a lot. Cut out the '"=" between RETURN and CALCULATE and it is working perfectly! Is there any chance you could give me a quick rundown on the formular and what is actually beeing calculated and how?

Cheers!

Microsoft

Hi @Keha

I'm sure there are a few approaches but what this does is work out how many days there were in total for the previous month.

So if the date of your current row is the 15th of February, it counts the number of days in January (31) and subtracts this number in days from the 15th of Feb.  You can't subtract a hardcoded because you'll end up on a different day.

Does that help?

Proud to be a Datanaut!

Frequent Visitor

Splendid! Thanks so much!

Any chance you might have an Idea about the colorcoding?

Microsoft

@Keha

In a chart, the color of bar is based on the legend and category on X axis. It's not based on the Value. And you have to set it manually. There's no conditional formatting in chart visuals.

Regards,

Announcements

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors