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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Variable columns

Good morning

I have the following problem that I do not know if it can be solved:

Monthly they provide an Excel file (exported from an application) with month-to-month expenses and forecasts. That is, for each row there are 12 columns with the allocated expense of each month and 12 columns with the expense forecast for each month.

If for example we take the file from August, it will have details of the expenses from January to August and the updated forecasts from January to December.

But the report to be generated, the columns to be displayed vary with the month to be reported. For example, August would show:

The expense incurred in the month, the expected expenditure of the month, followed by the one incurred from January to August, and followed by the expected expenditure from September to December.

informe.gif

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

I created a sample pbix file(see attachment) base on your sample data, please check whether that is what you want.

Variable columns.JPG

Best Regards
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@Anonymous , not very clear.

But you need to unpivot the data.

https://radacad.com/pivot-and-unpivot-with-power-bi
Transpose : https://yodalearning.com/tutorials/power-query-helps-transposing-data/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks, but that's not the problem. The data at source is correct:

Actuals.gif

Forecast.gif

File consists of 25 columns: 1 column with the description of the Service, 12 columns with the expense month by month (January, February, ..., December) and 12 columns with forecast month to month (January, February, ..., December).

The problem is when generating the report that of the 25 columns I have to present only 15:

  1. Service description
  2. Expenditure of the current month (depending on the month to be reported will be Actual January or Actual February or .... Current December).
  3. Forecast of the current month (depending on the month to be reported will be Real Forecast January or Real Forecast February or .... Real Forecast December)
  4. Expenses up to the current month (If we are in August: Actual January, Current February, ..., until Actual July) --> In August 9 columns of current
  5. Forecasts for the months after the current month (If we are in August: Real Forecast Octover, Real Forecast November and Real Forecast December) --> In August 3 columns of forecast

Anonymous
Not applicable

Hi @Anonymous ,

Could you please provide some sample data and your expected result with examples? And if it involves any calculation, please provide the backend logic. Thank you.

Best Regards

Rena

Anonymous
Not applicable

Hola Rena,

I sent you a few data, example of the August report and the calculations/logic

Calculations/Logic:

Column FormulaExample AugustExample April
EACYTD + ETCYTD + ETCYTD + ETC
YTDCurrent summation from January, to the month to be reportedActual January + Actual February + Actual March + Actual April + Actual May + Actual June + Actual July + Actual AugustActual January + Actual February + Actual March + Actual April
ETC Forecast summarium from the month to be reported + 1, through DecemberForecast September + Forecast October + Forecast November + Forecast DecemberForecast May + Forecast June + Forecast July + Forecast August + Forecast September + Forecast October + Forecast November + Forecast December
Current MonthCurrent month to reportActual AugustActual April
F Current MonthForecast of the month to be reportedForecast AugustForecast April
G Actual JanuaryActual January
H Actual FebruaryActual February
I ActualMarchActualMarch
J Actual AprilActual April
K Actual MayForecast May
L ActualJuneForecast June
M ActualJulyForecast July
N Actual AugustForecast August
O Forecast SeptemberForecast September
P Forecast OctoberForecast October
Q Forecast NovemberForecast November
R Forecast DecemberForecast December

Report:

ServiceEACYTDETCCurrent MonthF Current MonthA JanuaryA FebruaryA MarchA AprilA MayA JuneA JulyA AugustF SeptemberF OctoberF NovemberF December
Service 1 646.773 504.397 142.376 4.828 45.064 2.163 6.922 105.440 172.578 92.171 85.707 34.587 4.828 76.804 40.607 22.390 2.575
Service 2 1.221.357 976.781 244.576 55.337 20.430 111.174 131.236 167.130 147.266 143.121 114.978 106.538 55.337 79.041 83.586 64.302 17.647
Service 3 1.195.295 998.955 196.340 23.447 61.000 32.135 27.921 444.460 51.347 112.094 256.493 51.056 23.447 62.092 49.291 48.291 36.667
Service 5 44.289 42.106 2.184 1.174 1.256 6.188 7.942 8.569 878 7.666 2.227 7.461 1.174 1.073 910 200 -
Service 4 81.563 52.045 29.519 - - 30.034 18.074 61.282 5.764 - 64.044 935 - - - - - 29.519
Total 3.189.277 2.574.283 614.994 84.787 127.750 181.694 192.096 786.880 377.835 291.008 460.340 199.643 84.787 219.010 174.394 135.184 86.406

Data:

ServiceSubserviceForecast JanuaryForecast FebruaryForecast MarchForecast AprilForecast MayForecast JuneForecast JulyForecast AugustForecast SeptemberForecast OctoberForecast NovemberForecast DecemberActual JanuaryActual FebruaryActual MarchActual AprilActual MayActual JuneActual JulyActual AugustActual SeptemberActual OctoberActual NovemberActual December

Service 5SubService 10,000,000,000,004361,59396,53396,53396,53396,530,000,000,000,000,002038,563308,993965,060,000,000,000,000,000,000,00
Service 5SubService 10,000,000,007665,760,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,00
Service 5SubService 20,000,000,000,00306,58306,58306,580,000,000,000,000,000,000,000,000,000,000,00306,580,000,000,000,000,00
Service 5SubService 30,006482,025734,093624,94299,645105,863416,03599,14176,88422,280,000,000,003869,273988,93-3361,152817,181689,836174,501173,700,000,000,000,00
Service 5SubService 120,002730,002730,002730,002730,00797,50557,93260,38500,00488,00200,000,006188,074073,162541,06930,64

884,01

537,12980,060,000,000,000,00

0,00

Anonymous
Not applicable

Hi @Anonymous ,

I created a sample pbix file(see attachment) base on your sample data, please check whether that is what you want.

Variable columns.JPG

Best Regards
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.

Anonymous
Not applicable

Thanks a lot!! Solved!!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.