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
ContabilidadBI
Helper III
Helper III

KPI (Card) with this month unit sales vs last month unit sales (until this day of the month)

Hi!

I would like to have a card in the dashboard that shows the difference between the unit sales of current month (from the beggining of March until today, day 14 of March) and the unit sales of last month (from the beggining of Febreary until day 14 of Febreary).

 

Is that possible?

 

Thanks you so much!!!

1 ACCEPTED SOLUTION

Hi @ContabilidadBI,

 

In this example I have made I have linked it to a slicer if you don't make any selection and your data finish on March 14 it will give you current month on the measure. Measure are based on context and when you do a MTD it will fetch the maximum date on your table.

 

Just in case change the PM to 

 

Total MTD PM = 
var select_date = MAX(Data[Date] )
return
TOTALMTD(SUM(Data[Total]);CALCULATETABLE(DATEADD(Data[Date];-1;MONTH);Data[Date]= select_date))

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
MFelix
Super User
Super User

@ContabilidadBI,

 

You just need to make this measures:

 

TotalMT = TOTALMTD(SUM(Data[Total]);Data[Date]) 

Total MTD PM = TOTALMTD(SUM(Data[Total]);DATEADD(Data[Date];-1;MONTH) )

Difference = [TotalMT]-[Total MTD PM]

You can do a single measure with:

Difference = TOTALMTD(SUM(Data[Total]);Data[Date])  - 
TOTALMTD(SUM(Data[Total]);DATEADD(Data[Date];-1;MONTH) )

The TotalMTD calculates the Total value of a aggregation based on the calendar date you select in this case the 14 adding the DATEADD part you can select how the date column is filtered in this case I take 1 month form the date so 14 of March minus one month 14 of March.

 

I have made it in several so you could see the result:

 

February everyday as 200 in value March everyday as 300

 

14 * 200 = 2800

14 * 300 = 4200

 

Se the result below:

 

MTD.gif

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks MFelix,

 

I understand the problem a little more now but I would like to have a KPI type of card in the dashboard with the current month unit sales (so now its sales of March but will be sales of April next month) and the last month unit sales until same day of the month we are currently in as objective in the KPI. I hope is undersatandable what I want, sorry for my english.

 

Thanks!

Anonymous
Not applicable

Hi!

Did you find the correct solution for your issue? can you please share it with me? 🙂

thank you!

Hi @ContabilidadBI,

 

In this example I have made I have linked it to a slicer if you don't make any selection and your data finish on March 14 it will give you current month on the measure. Measure are based on context and when you do a MTD it will fetch the maximum date on your table.

 

Just in case change the PM to 

 

Total MTD PM = 
var select_date = MAX(Data[Date] )
return
TOTALMTD(SUM(Data[Total]);CALCULATETABLE(DATEADD(Data[Date];-1;MONTH);Data[Date]= select_date))

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.