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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Date intelligence

Hi,

 

I want to compare my actual result with the past result (1 week difference) to use in a KPI visualization and get the % difference. My measure is the following:

 

Total Clientes = DISTINCTCOUNT('BLABLA'[Codigo_Cliente])
 
I tried to create another measure to get the past result:
 
Total Clientes Anterior = CALCULATE([Total Clientes],DATEADD('BLABLA'[FechaCarga].[Date],-1,MONTH))
 
But it didnt work. How could I get this number?
 
 
 
Thanks in advance,
 
IC
4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Build a Calendar Table and create a relationship from the Date column of your base data Table to the Date column of the Calendar Table.  In the Calendar Table, create a Year and Month column with these calculated column formulas

Year = Year(Calendar[Date])

Month = FORMAT(Calendar[Date],"mmmm")

Create 2 slicer - one each for Year and Month.  Select any one Year and Month.  Now write these measures:

Total Clientes = DISTINCTCOUNT('BLABLA'[Codigo_Cliente])

Total Clientes Anterior = CALCULATE([Total Clientes],PREVIOUSMONTH(Calendar[Date])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi,

 

Could you go step by step in creating a Date table? I really need it to get one big date filter for everything.

 

I have different datasets with different date keys. One of them only have one date variable, but another one has two dates (product retention: one for start date and another for end date). I wanted to make a main date table that links to all of the datasets.

Hi,

Go to Modelling > New Table and write this formula

Calendar = CALENDAR(MIN(Table1[Date]),MAX(Table1[Date]))

Table1 is that Table which carries the minimum date of all Date column across all your Tables.  For the Table where you have a start and end date, we will need to create a single Date column in the Query Editor.  Thereafter, you can create relationships from the Date column of all Tables to the Date column of the Calendar Table.  I can offer more help, if i get some data to work on and if you can be clear about exactly what you want.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Community Champion
Community Champion

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT....

 

Also, check out my Quick Measures that deal with weeks:

https://community.powerbi.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=fals...

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors