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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dannn777
Frequent Visitor

Aggregate by month: This year & last year for graph representation

Hi,

 

I am using a live connection to an SSAS model.

 

I am trying to graph 2 measures - won this year and won last year for a graph. Obviously with the series being the month name.

 

I have 2 dax measures creating the totals for this year vs last year which seem to work correctly on their own.

 

wonThisYear = countrows(filter(Table, Table[WonDate]>date(year(TODAY()), 1, 1))) 
wonLastYear = countrows(filter(Table, Table[WonDate]>date(year(TODAY())-1, 1, 1) && Table[WonDate] <= date(YEAR(TODAY())-1,12,31)))

 

However in table view it seems to show 1 entry per date rather than aggregating the dates together. E.g.

 

Capture.PNG

 

This also graphs horribly:

 

Capture.PNG

 

The aspiration is something like this:

 

Capture.PNG

 

 

Any guidance appreciated.

8 REPLIES 8
sokg
Solution Supplier
Solution Supplier

Can you provide us demo data???

dannn777
Frequent Visitor

It's just a series of dates that i'm looking to summarize. The picture in my 1st post without the 2nd column.

sokg
Solution Supplier
Solution Supplier

Do you use a calendar table???

dannn777
Frequent Visitor

I'm connecting to a SSAS model which is the pure data source. I don't have the facility to create new tables either in the model or powerBI because of the live connection.

sokg
Solution Supplier
Solution Supplier

Sorry but i haven't experience with SSAS models, but it will be easy if you have a calendar table.

dannn777
Frequent Visitor

I can probably get a calendar table created for use in the model which I understand should function the same. Can you advise how I can accomplish this with a calendar table?

sokg
Solution Supplier
Solution Supplier

NoOfWons = COUNTROWS(Sheet1)

 

NoOfWonsSPLY = CALCULATE([NoOfWons];SAMEPERIODLASTYEAR(dCalendar[Date]))

 

the result is :

 

Capture.JPG

sokg
Solution Supplier
Solution Supplier

or you can slice by month and year

 

Capture.JPG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors