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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Measure calculation with Matrix (Dates)

I´m having troubles using measures in matriz, and i hope that someone can help me.

So my problem is the next:

I want to calculate the sum of all where the date = date of piece, being that the date is the line of the matriz. I have tried to calculate with the code: 

Calculate(Sum(profit), Filter(table, table[dataPiece].[Year] = max(table[data].[Year] && table[dataPiece].[Year] = max(table[data].[Month])))

But the result ins´t getting right because some times the date ins´t the same that the date of piece.

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous 

 

I would strongly advise that you read this guide on how to create correct models in PBI before you start creating something at work. I can see you are using automatically generated date hierarchies in your table(s). This is totally wrong. You should never do it. Please create a dedicated date dimension table in the model. The guide will explain why you should not do that and have a dedicated date/time dimension.

amitchandak
Super User
Super User

@Anonymous ,  Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Are you trying to get same month data everywhere

The try

Full month = CALCULATE(SUM(Table[Profit]),DATESMTD(ENDOFMONTH('Date'[Date])))

 

month till date

MTD = CALCULATE(SUM(Table[Profit]),DATESMTD('Date'[Date]))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak ,For exemple:

I have created an column "DateFull" that gets where de piece current is situatedimage.png:

And my matrix: 

image.png

And my Measure:

image.png

As we can see, the result in January is getting 1, but the result expected is 5 because all 5 is situated in January.

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.