cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
joshua1990
Post Prodigy
Post Prodigy

Matrix with columns and rows from dimensional and transaction table

Hi all!

I have a simple data model with 3 tables. 

  1. Calendar table with Date, Week, Month, Year
  2. Actual Values table with values for each day
  3. Exctraction values with values for each Month.

The Actual Values and Extraction table are linked to the calendar table.

The extraction table contains a snapshot for every Month.

Extraction Year-Week Article Value
2023-Jan A 50
2023-Jan B 60
2023-Feb A 50

 

Now I would like to create a matrix visual with the individual extractions on rows and

  • Values from Actual table if the date is before the start date for the extraction
  • Values from Extractions if the date is at or after the extraction start date.

In the end I would like to have such kind visualization:

joshua1990_0-1679997659679.png

 

How would you build the data model and measures for that kind of objective?

5 REPLIES 5
v-jingzhang
Community Support
Community Support

Hi @joshua1990 

 

I recommend that you add another table which has distinct extraction months. This table should not be connected to the calendar table so it won't be affected by the calendar table. And disable or delete the relationship between the calendar table and the Exctraction table. 

vjingzhang_0-1680154188760.png

Then create the following measure and add it to the matrix. 

Measure = IF(MAX('Date'[Date])<MIN('ExtractionMonths'[Extraction Start Date]),SUM(ActualTable[Value]),SUM('ExctractionTable'[Value]))

vjingzhang_1-1680154275735.png

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

 

@v-jingzhang : Any ideas? Do we need a SUMMARIZE?

Hi @joshua1990 

 

Yes, you need an additional measure to summarize the total. 

Measure 2 = SUMX(SUMMARIZE('Date','Date'[YearMonth],"SumOfValue",[Measure]),[SumOfValue])

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

@v-jingzhang : Thanks a lot, appreciate. But the total (column subtotal) is wrong. It shows me 120 for 2023-Feb

joshua1990
Post Prodigy
Post Prodigy

If you need further information, just let me know. I am grateful for any tips that you can share.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors