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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
thliberato
Helper I
Helper I

TOPN current month x quantity Tickets Last Month

Good Morning. I need help.

 

I Have one fact table named F_incidents.
I created 3 measure listed below:

 

-Qtde Raised sem vazio= CALCULATE(COUNTROWS(F_Incidentes);F_Incidentes[CATEGORIA_KPI]="Raised";F_Incidentes[COD_SEQ_SISTEMA]>0)

 

Raised TopN = if(HASONEVALUE(dTOPN[TOPN]);if(rankx(all(D_Sistema[SISTEMA]);[Qtde Raised sem vazio])<=values(dTOPN[TOPN]);[Qtde Raised sem vazio];blank()))

 

Rank = rankx(all(D_Sistema[SISTEMA]);[Qtde Raised sem vazio])

 

With these mesuares I created the [TOP5 System (ticket number) x November (Selected in calendar filter)] Bar Graph.

This graph shows top5 Systems with the bigest quantity of tickets per month (I selected the month in a filter). (Like first grah in a example.

 

Now, I need your help to include in the same bar graph an additional information (Column):

Quantity of tickets considering the previous month considering that one selected in a filter.

 

Example.

I Choose in a calendar filter: November.

 

First graph shows top5 system x November.

TOP5.JPG

 

The second graph need shows top5 System (november) x Quantity tickets previous month (October ins this example).

 

 

1 ACCEPTED SOLUTION
bourquejeff
Frequent Visitor

I've solved your problem using the PREVIOUSMONTH function in DAX. I have a workbook I can send you with the solution if you have an email address I can send it to.

 

In short:

 

Make sure you have a calendar table where the date field is data type: "Date" and you also have a date field with data type: "Date" on your TicketSales table. 

 

For TOPN, you can just use the new filter in Power BI: https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-october-feature-summary/preview/#topN

 

Then, add this measure (edited with your specific information):

 

TicketsLastMonth = CALCULATE(SUM(TicketSales[Ticket Sales]), PREVIOUSMONTH('Calendar'[Date]))

 

Add the Month slicer from your Calendar table, then add a Clustered Column Chart with your System on Axis, and TicketSales and TicketsLastMonth on Values.

 

 

View solution in original post

1 REPLY 1
bourquejeff
Frequent Visitor

I've solved your problem using the PREVIOUSMONTH function in DAX. I have a workbook I can send you with the solution if you have an email address I can send it to.

 

In short:

 

Make sure you have a calendar table where the date field is data type: "Date" and you also have a date field with data type: "Date" on your TicketSales table. 

 

For TOPN, you can just use the new filter in Power BI: https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-october-feature-summary/preview/#topN

 

Then, add this measure (edited with your specific information):

 

TicketsLastMonth = CALCULATE(SUM(TicketSales[Ticket Sales]), PREVIOUSMONTH('Calendar'[Date]))

 

Add the Month slicer from your Calendar table, then add a Clustered Column Chart with your System on Axis, and TicketSales and TicketsLastMonth on Values.

 

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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