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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
PowerBI88
Helper III
Helper III

Measure is giving me blank

Hi,

I am trying to calculate weekly forecasting, but the following measure returns blank:

 

Forecasting Pw =
Var CurrentWeek = SELECTEDVALUE(AzureUsageRecords[WeekNumber])
var CurrentYear = SELECTEDVALUE(AzureUsageRecords[DateCost].[Year])
var MaxWeekNumber = CAlculate(max(AzureUsageRecords[WeekNumber]), ALL(AzureUsageRecords))
RETURN
SUMX(
FILTER(ALL(AzureUsageRecords),
if(CurrentWeek = 1,
AzureUsageRecords[WeekNumber] = MaxWeekNumber && AzureUsageRecords[DateCost].[Year] = CurrentYear -1,
AzureUsageRecords[WeekNumber] = CurrentWeek - 1 && AzureUsageRecords[DateCost].[Year] = CurrentYear)), 'RegressionelineareApplicazoni(Fine Mese)'[ForecastingEUR])
 
Any hint on why it is behaving this way?
 
Thank you
Kind regards
Marta

 

1 ACCEPTED SOLUTION
PowerBI88
Helper III
Helper III

I managed to solve my problem, by creating the measure on the correct date table.

View solution in original post

6 REPLIES 6
PowerBI88
Helper III
Helper III

I managed to solve my problem, by creating the measure on the correct date table.

@PowerBI88 
That's amazing news, sorry for not answering lately.
If you could please share your solution and accept it as Solution, so you can close this thread and other people can find it useful.

vojtechsima
Memorable Member
Memorable Member

Hi, @PowerBI88 
From quick observation, it looks okey, could you share a sample dataset (copyable) so I could try it on my own, please?

My dataset is full of sensitive data, I don't know how to mask it.

I checked the output with a table diagram and it is actually not blank, but the value for Forecasting PW is wrong:

PowerBI88_0-1649835677413.png

I think also it is important to say that the value Forescasting Eur comes from a different table with respect to AzureUsage records (RegressionelineareApplicazoni(Fine Mese)'[ForecastingEUR])) and that the two tables are not directly related.

 

Kind regards

 

HI, @PowerBI88 
Hmm, maybe you could create a Data Calendar and make a relationship to both tables and then use it in the calculation. IT could help.

Also,
I understand you can'T show me the exact data. However, if you could create a "fake" table with random values which would have the same structure, that would help me a lot.
Just make something in excel and Copy it here, so I can paste it directly to Power BI.

This is AzureUsage records Table:

CostoDateCost_MonthNumber_DayNoOfYearWeekNumberYearYear&WeekForecasting Pw
0,00 €28/02/2022 00:00259920222022-933.000
0,00 €28/02/2022 00:00259920222022-944.00
0,00 €28/02/2022 00:00259920222022-944.01
0,00 €28/02/2022 00:00259920222022-944.02
0,00 €28/02/2022 00:00259920222022-944.03
0,00 €28/02/2022 00:00259920222022-944.04

This is RegressionelineareApplicazoni(Fine Mese)

Applicazione,ForecastingEUR
app01,75111 €
app02,450272 €
app03,10838 €

this is the chain of relationships:

PowerBI88_0-1649921616219.png

PowerBI88_1-1649921639847.pngPowerBI88_2-1649921657247.png

Kind regards

Marta

 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.