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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Elieazar
New Member

DAX function to register MTD, QTD and other giving wrong results.

Hello,

 

I am trying to create a data slicer with various period filters such as MTD, QTD, YTD ...
I have already created a specific table that gives me 12 rows with each row being the first of each month from January till December of 2024.
However, when i use each periodic function, it's giving me the wrong result as if the end date is December 2024...
For example, this is the DAX function for each period :

Union(
ADDCOLUMNS(DATESMTD('Période Comptable'[Mois]),"Période","MTD"),
ADDCOLUMNS(DATESQTD('Période Comptable'[Mois]),"Période","QTD"),
ADDCOLUMNS(DATESYTD('Période Comptable'[Mois]),"Période","YTD")
)
But as you can see in the attached picture, it shows MTD row as December 2024, QTD it's giving me the last quarter of the year and YTD it's giving me the entire year...
Help pleasse.

Thank you,

 
Elie AZAR
Problème Power BI.png
2 REPLIES 2
Elieazar
New Member

Hello Jayleny,

 

Thank you for your reply and sorry for my late response.

Here are my responses :

  1. My date table is marked as a date so no problems there.
  2. I tried a test with a row for each day of the year but the result was wrong as if i was in december 2024 like in my explanation but for a longer period

As for what i want :

  1. I wand to be able to create a table with 2 columns :
    1. the first column is the date ranges
    2. the 2nd is MTD, QTD, YTD and other specifics i can add on one the first ones are functional. Evidentally the MTD, QTD and YTD should have the end period of today and not december 2024.
  2. Eventually, i want to create a slicer with this MTD, QTD and YTD table (cf. attached picture)

Please find the PBIx file with just the dates as well as the new table i tried to create.

Thank you in advance for your help,

 

Elie AZAR

Power BI Objectif.png

Anonymous
Not applicable

Hi @Elieazar 

 

The first thing to check is whether your date table ('Période Comptable') is properly set up:
Continuous Dates: Your date table should ideally have a row for every single day in the year, not just the first of each month. Date intelligence functions expect a full range of dates to calculate periods correctly.


Mark as Date Table: In Power BI, ensure that your date table is marked as a date table. You can do this by going to the "Modeling" tab and selecting "Mark as Date Table", then choose the column that has the date.

 

If the above suggestions don't help you solve the problem, please provide detailed sample pbix file and the results you expect.So that I can help you better. Please remove any sensitive data in advance.

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.