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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
game1
Helper III
Helper III

KPI based on previous

I want to calculate with a DAX formula the Target of my KPI based on the filter of the date of the same month, but of the previous year and multiply by 2. FOR EXAMPLE, if I have in January 2020 count a total number of 100 for YourTable[date] as the number of rows (i.e. count the total number of rows of the YourTable[date] column corresponding to the period January 2020), then my Target for January 2021 should return 200.
If I have in 2020-01-01, 1000 as the number of rows of YourTable[date], then this should return me 2000 for 2021-01-01, as my Target. So, each time, my Target must take into account the number of rows for the same period and multiply it by 2. I use a Slicer to filter my dates. So, if I just select 2019 as the year and it returns 10000 as the number of rows, then my target should return 20000.

 

3 REPLIES 3
ValtteriN
Super User
Super User

Hi,

Here is how to do this:

data:

ValtteriN_0-1703148201918.png

Relationship:

ValtteriN_1-1703148221779.png

DAX:

target =
CALCULATE(MAX('Table (15)'[Value]),DATEADD('Calendar'[Date],-1,YEAR))*2

Now in the visual I am using 'Calendar'[Date] and target measure:
ValtteriN_2-1703149005281.png

 

When a single date is selected the value changes accordingly.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/




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

Proud to be a Super User!




This one work only if i select the same day, month, year ? FOR EXAMPLE, if I have in January 2020 count a total number of 100 for YourTable[date] as the number of rows (i.e. count the total number of rows of the YourTable[date] column corresponding to the period January 2020), then my Target for January 2021 should return 200.  It should then only consider only the total of the same month and year.

Anonymous
Not applicable

Hi @game1 ,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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