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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Syndicate_Admin
Administrator
Administrator

Performance and functionality of the DAX formula

Good afternoon, I have the following problem.

I have the following data model

Petazo__0-1691003424052.png

The Price List table is a table with approximately 12 million records, since they are sku codes and dates, while the SKC IPC table has a subset of codes that want to evaluate the evolution of prices over time.

For this I made the following table (as a visualization)

Petazo__1-1691003590226.png

The last 2 forimulas what they are looking for is the variation of the column Price LP respcto of the previous one, is constructed in the following way:

Variation ($) Prices =
where _pre=
CALCULATE(
.MAX('Price Lists'[fecha_creacion_lp]),
FILTER(ALL('Price Lists'),
'Price Lists'[Key 1]=MIN('Price Lists'[Key 1]) &&
'Price Lists'[fecha_creacion_lp]<MIN('Price Lists'[fecha_creacion_lp])
)
)
where _preRES=
CALCULATE(
.MAX('Price Lists'[LP Price]),
FILTER(ALL('Price Lists'),
'Price Lists'[Key 1]=MIN('Price Lists'[Key 1]) &&
'Price Lists'[fecha_creacion_lp]=_pre))
return
IF(
ISBLANK( _preRES),
BLANK(),
MIN('Price Lists'[LP Price])-_preRES)
and the second is percentage
Variation (%) Prices =
where _pre=
CALCULATE(
.MAX('Price Lists'[fecha_creacion_lp]),
FILTER(ALL('Price Lists'),
'Price Lists'[Key 1] =MIN('Price Lists'[Key 1]) &&
'Price Lists'[fecha_creacion_lp]<MIN('Price Lists'[fecha_creacion_lp])
)
)
where _preRES=
CALCULATE(
.MAX('Price Lists'[LP Price]),
FILTER(
ALL('Price Lists'),'Price Lists'[Key 1]=MIN('Price Lists'[Key 1]) &&
'Price Lists'[fecha_creacion_lp]=_pre))
return
IF(
ISBLANK( _preRES),
BLANK(),
DIVIDE( MIN('Price Lists'[LP Price]),_preRES)-1)
The results are correct, as seen in the resulting table, however when adding these two 2 measures the performance is significantly slower, either when filtering something, when expanding or contracting the visualization etc. and the second problem I present is that when you collapse the table, the results are wrong.
Petazo__2-1691004478709.png

Then I would like help in 2 topics (sorted by priority)

1.- Improve the performance of the measure created
2.- Correct the measure so that when grouping / contracting the visualization correctly calculates the variation in $ and %

From already thank you very much!

0 REPLIES 0

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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