Forum Discussion
HowAreYou
1 year agoNew Member
Iterative row calculation
Hello community! Could you please help me to understand and create suitable calculation for this case? I have fotovoltaics where I generate electricity and I have also 2 locations where I consum...
Kedar_Pande
1 year agoSuper User
Establish a relationship between the two tables on the DateTime field.
Create a Table for Multipliers:
Multipliers = DATATABLE("Multiplier", INTEGER, {{1}, {2}, {3}, {4}, {5}})Add a slicer to your report using this new Multipliers table.
Measure for Adjusted Generation:
Adjusted Generation (kW) =
VAR SelectedMultiplier = SELECTEDVALUE(Multipliers[Multiplier], 1)
RETURN
SUMX(GENERATIONTABLE, GENERATIONTABLE[Generation (kW)] * SelectedMultiplier)
Measure for Percentage Covered
% Covered =
VAR CurrentConsumption = SUMX(CONSUMPTIONTABLE, CONSUMPTIONTABLE[Consumption (kW)])
VAR CurrentGeneration =
CALCULATE(
[Adjusted Generation (kW)],
FILTER(GENERATIONTABLE, GENERATIONTABLE[DateTime] = MAX(CONSUMPTIONTABLE[DateTime]))
)
RETURN
IF(CurrentConsumption > 0, DIVIDE(CurrentGeneration, CurrentConsumption, 0), 0)
Format the % Covered measure as a percentage in Power BI by going to the measure properties and setting the data type to percentage.