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 August 31st. Request your voucher.

Reply
Syndicate_Admin
Administrator
Administrator

Visual KPIs for dynamic dates

Good morning everyone,
Thank you so much for reading the post, but after trying, I find myself looking for the solution.
I find a data table where there are DAY, MONTH AND YEAR and also Orders:
MONTH DAY YEAR Orders

JANUARY15202325
JANUARY30202352
FEBRUARY152023345
FEBRUARY30202358
MARCH152023245
MARCH30202356
APRIL152023745
APRIL302023587
MAY152023245
MAY3020232
JUNE1520235
JUNE302023525
JULY15202325
JULY3020236
AUGUST1520237
AUGUST302023142
SEPTEMBER1520235
SEPTEMBER30202356
OCTOBER15202396
OCTOBER30202345
NOVEMBER15202383
NOVEMBER302023555
DECEMBER15202377
DECEMBER3020234
JANUARY1520248
JANUARY30202455
FEBRUARY152024555
FEBRUARY302024861
MARCH15202464
MARCH30202459
APRIL152024245
APRIL30202452
MAY1520248
MAY3020247
JUNE15202477
JUNE30202452
JULY15202464
JULY3020245
AUGUST15202489
AUGUST30202435
SEPTEMBER152024235
SEPTEMBER30202441
OCTOBER152024255
OCTOBER30202458
NOVEMBER15202455
NOVEMBER3020246
DECEMBER15202466
DECEMBER30202448

Now I want to use the KPI chart with incremental decreases:

migueldfr_0-1727866449432.png

I want to get a measure that is dynamic, whether I select one day returns the current value, the selected one:

migueldfr_1-1727866515718.png

Whatever the trend axis is, as it changes, be it year, month or day.

migueldfr_2-1727866552282.png

And in the destination precisely the previous value.

migueldfr_0-1727875315381.png

That is, if I select a year, that it is the destination of the previous year, if I select a month, that it is the month of last year, and if I select a day that is the same day last year.

migueldfr_1-1727875436137.png

This is what I have tried for current value, but it changes everything at once.

Valor_Actual = 
VAR AnioSeleccionado = SELECTEDVALUE('MasterCalendar'[Year])
VAR MesSeleccionado = SELECTEDVALUE('MasterCalendar'[Month Number])  -- Asegúrate de que este campo contenga solo el número del mes (1-12)

RETURN
CALCULATE(
    COUNT('EncargosAnx'[encargos_id]),
    'EncargosAnx'[fecha] >= DATE(AnioSeleccionado, MesSeleccionado, 1) &&
    'EncargosAnx'[fecha] < EDATE(DATE(AnioSeleccionado, MesSeleccionado, 1), 1)  -- Para incluir hasta el último día del mes
)

I appreciate any help

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

Hi @migueldfr,

I'm attaching one pbix file with my solution.
I hope this could help you.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @migueldfr 

 

Did _AAndrade 's method solve your problem? If yes, could you please mark it as solution? This will help more users who are facing the same or similar difficulties. Thank you!

 

If you still have questions, please feel free to ask me.

 

Best Regards,
Yulia Xu

Syndicate_Admin
Administrator
Administrator

Hi @migueldfr,

I'm attaching one pbix file with my solution.
I hope this could help you.

thnak you so much @Syndicate_Admin 

Such a great approach and wonderful way to sove this problem

I really appreaciate it

Anonymous
Not applicable

Hi @Syndicate_Admin 

 

Thank you for your sharing.

 

Best Regards,
Yulia Xu

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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