Forum Discussion

leodec11's avatar
leodec11
Frequent Visitor
1 year ago
Solved

How to align multiple tables and create dynamic last 3 months columns when migrating from Tableau

I am trying to migrate a Tableau dashboard to Power BI, and I’m having difficulty building the tables in the desired format.

I currently have 3 separate tables:

  • Matrix table – showing Classroom, Section, and PreviousYrRatio.
  • Last 3 months table – showing dynamic months (e.g., Jun-25, Jul-25, Aug-25).
  • YTD table – showing year-to-date values.

When I place these 3 tables side by side on the Power BI page, empty space appears between them, and alignment becomes difficult.

I also tried creating a calculation group with 3 columns (PreviousYrRatio, Last 3 Months, YTD), but the issue is that the “Last 3 Months” values appear as a single column instead of showing 3 dynamic month columns with headers.

Question:- How can I build this in Power BI so that the 3 sections (classroom,section,PreviousYrRatio, Jun-25, Jul-25, Aug-25, YTD) appear in one aligned table, with the last 3 months shown as separate dynamic columns?

6 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    leodec11 Sorry, having trouble following, can you post sample data as text and expected output?
    Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

    Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

    • leodec11's avatar
      leodec11
      Frequent Visitor

      Sample data is in the format 

      YRMNTHspecnumerdeno
      202402IT210
      202506FP324
      202506FP432
      202402IT212
      202507FP145
      202506IT212
      202508FP323

      Result Expected where jun-2025, jul-2025,aug-2025 is dynamic column header showing last 3 months from current date. Basic calculation is numer/deno for each spec

      specPreviousYearJun-2025Jul-2025Aug-2025YTD
      FP00.1250.02220.130.088
      IT0.180.16000.16
  • Hi leodec11 

    What you are trying to replicate is essentially a single pivot-style matrix where different measures (PreviousYrRatio, YTD) sit alongside dynamic month columns, but Power BI doesn’t allow you to simply stitch three independent visuals together without spacing or alignment issues. Placing separate tables side by side leads to the gaps you’re seeing, and calculation groups alone won’t create multiple dynamic columns—they return one column at a time. The best practice here is to restructure your model so that you can use a single Matrix visual: keep Classroom and Section as row headers, then unpivot your measures so that you can display them in columns. For the “Last 3 Months,” you can create a measure that returns values for the current month, prior month, and two months back, then use a disconnected Date table or a DAX pattern with SELECTEDVALUE/SWITCH to generate separate measures for each month, ensuring they appear as three distinct dynamic columns with proper headers (e.g., Jun-25, Jul-25, Aug-25). In other words, you’ll need to align everything in one Matrix visual with carefully designed DAX measures or a combination of calculation groups and measure branching, rather than trying to combine multiple visuals. This way, the final output is a single table with Classroom, Section, PreviousYrRatio, each of the last 3 months as separate columns, and YTD, all properly aligned.