如何在MicroStrategy Developer中实现行转列报表并添加多指标
Solution to Pivot Period with Dual Metrics in MicroStrategy Developer
Method 1: Dynamic Pivot (Scalable for Any Periods)
This approach avoids creating individual metrics for each period and works for any number of period values:
Set Up the Report Structure:
- Drag
Contract_IDto the Rows axis. - Drag
Periodto the Columns axis. - Drag both
ForecastandShortfallmetrics directly onto thePeriodattribute in the Columns panel—this nests the metrics under each period, so every period will have two sub-columns (Forecast and Shortfall).
- Drag
Customize Column Headers:
- Double-click each column header to edit it. Combine the period name and metric name (e.g., change "Forecast" under May23 to "May23Forecast"). Use the batch edit option (right-click header area > Batch Edit Headers) to speed this up.
Add Total Metrics:
- Create two new metrics:
Total Forecast: Formula:Sum(Forecast), set the level toContract_ID(right-click metric > Edit > Level tab > Select Contract_ID).Total Shortfall: Formula:Sum(Shortfall), level set toContract_ID.
- Drag these two total metrics to the end of the Columns axis.
- Create two new metrics:
Hide Zero Values:
- For all metrics, go to Format > Metric Format > Number tab, set "Display zero as" to blank. This ensures empty cells show nothing instead of 0.
Method 2: Static Period-Specific Metrics (For Fixed Periods)
If you only need to handle the three periods in your example, create dedicated metrics for each combination:
Create Period-Filtered Metrics:
- For each period-metric pair, make a new metric:
May23Forecast:Forecastfiltered byPeriod = 'May23'(add filter in metric editor).May23Shortfall:Shortfallfiltered byPeriod = 'May23'.- Repeat for
June24andSept22to get all six metrics.
- For each period-metric pair, make a new metric:
Assemble the Report:
- Add
Contract_IDto Rows. - Add all six period-specific metrics to Columns in your desired order.
- Add the
Total ForecastandTotal Shortfallmetrics (from Method 1 step 3) to the end of Columns.
- Add
Format Empty Cells:
- Set each period-specific metric to display blank when no data exists (same as Method 1 step 4).
Troubleshooting Tip:
If you can't add Shortfall when Period is in Rows, it's because you're trying to place metrics in Rows instead of Columns. Ensure Period is in Columns, and metrics are nested under it or placed alongside to get the pivoted structure you need.
内容的提问来源于stack exchange,提问作者simplysimply
相关产品推荐
相关产品推荐

