Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
I have the need to build reports with dynamic headers for field names.
The Userbase want to do variance anaylsis on various scenarios. To enable this, they chose a version to be the base and then chose a comparator. A variance is then generated by the calculation Version 1 - Version 2. So far so easy. However I wish to dynamically change the fied names of the calculations (V1 repersenets Version1, V2 represents Version2). I can manually rename the field headers (which is pointless as they are still static - so any change to the versions would not be represented). I have a formula that correctly derives the titles but it seems I can not use a formula to update the headers (which from my point of view is absolutely basic functionality). Is there any way around this issue? Please see below screenshot for details (real data has been replaced by a representation). Any help would be greatly appreciated.
Solved! Go to Solution.
Here's a solution that uses field parameters (see link below). Create a field parameter for each version. In your model, you would have six rows (one for each measure) in each field parameter.
VersionV1 = {
("Actual", NAMEOF('Measure'[Actual]), 0),
("Budget", NAMEOF('Measure'[Budget]), 1),
("Forecast", NAMEOF('Measure'[Forecast]), 2)
}
VersionV2 = {
("Actual", NAMEOF('Measure'[Actual]), 0),
("Budget", NAMEOF('Measure'[Budget]), 1),
("Forecast", NAMEOF('Measure'[Forecast]), 2)
}
Create a variance measure:
Variance =
VAR vVersion1 =
TREATAS ( { MAX ( VersionV1[VersionV1] ) }, FactTable[Version] )
VAR vVersion2 =
TREATAS ( { MAX ( VersionV2[VersionV2] ) }, FactTable[Version] )
VAR vVersion1Amount =
CALCULATE ( [Amount], vVersion1 )
VAR vVersion2Amount =
CALCULATE ( [Amount], vVersion2 )
VAR vResult = vVersion1Amount - vVersion2Amount
RETURN
vResult
The Amount measure is a sum of your fact table amount:
Amount = SUM ( FactTable[Amount] )
Create a matrix with the field parameters and Variance measure:
Result:
-----
https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters
Proud to be a Super User!
Here's a solution that uses field parameters (see link below). Create a field parameter for each version. In your model, you would have six rows (one for each measure) in each field parameter.
VersionV1 = {
("Actual", NAMEOF('Measure'[Actual]), 0),
("Budget", NAMEOF('Measure'[Budget]), 1),
("Forecast", NAMEOF('Measure'[Forecast]), 2)
}
VersionV2 = {
("Actual", NAMEOF('Measure'[Actual]), 0),
("Budget", NAMEOF('Measure'[Budget]), 1),
("Forecast", NAMEOF('Measure'[Forecast]), 2)
}
Create a variance measure:
Variance =
VAR vVersion1 =
TREATAS ( { MAX ( VersionV1[VersionV1] ) }, FactTable[Version] )
VAR vVersion2 =
TREATAS ( { MAX ( VersionV2[VersionV2] ) }, FactTable[Version] )
VAR vVersion1Amount =
CALCULATE ( [Amount], vVersion1 )
VAR vVersion2Amount =
CALCULATE ( [Amount], vVersion2 )
VAR vResult = vVersion1Amount - vVersion2Amount
RETURN
vResult
The Amount measure is a sum of your fact table amount:
Amount = SUM ( FactTable[Amount] )
Create a matrix with the field parameters and Variance measure:
Result:
-----
https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters
Proud to be a Super User!
It might be better to teach your users how to personalize visuals, how to use the filter pane (where all your buttons belong) and how to use Analyze in Excel. Otherwise you're looking at a maintenance nightmare.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
126 | |
113 | |
71 | |
65 | |
46 |