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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Matrix: Getting rid of blank spaces

Hi everyone, 

I am trying to build a Matrix with two different categories A and B as 'Values' in the  visualization panel and months as columns.  I am doing this, because I want to put a different color in the bars (orange or green). But now I am getting two values for January, Februry and so on. This makes no sense, because there is only one value for Category A and one for Category B for month.

How can I get rid of those blank spaces in between? So I only have on value for month. 

Aditionally I would also like to have in the same matrics two calculated measures: Category A last year and Category B last year 🙂 How can I get it? 

 

 

Bild (5).png

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous 

 

Did Joe_Barry 's and suparnababu8's methods solve your problem? If yes, could you please mark them as solutions? This will be of great help to other users experiencing similar problems. Thank you!

If you still have questions, please feel free to ask me.

 

Best Regards,
Yulia Xu

suparnababu8
Super User
Super User

Hi @Anonymous 

 

By using ISBLANK function you can handle the blanks
First create this measure to handle blanks as zero's. 

A = IF(ISBLANK(SUM(Table[CategoryA])), 0, SUM(Table[CategoryA]))
B = IF(ISBLANK(SUM(Table[CategoryB])), 0, SUM(Table[CategoryB]))

 

Then you create this easure 

CategoryALastYear = 
CALCULATE(SUM(Table[CategoryA]),
    SAMEPERIODLASTYEAR('Calendar'[Date])
)

category B 

CategoryBLastYear = 
CALCULATE(SUM(Table[CategoryB]),
    SAMEPERIODLASTYEAR('Calendar'[Date])
)

 

Then, drag the new measures (CategoryALastYear and CategoryBLastYear) into the Values field of your matrix visual.

Hope this helps you!

Joe_Barry
Super User
Super User

Hi @Anonymous 

 

Do you have the categories in the column field? if yes, then this expected behaviour. It will happen too, if you put it in the rows.

 

Regarding the calculations:

If your data model is set up in a Star schema and you have a date table, these measures will help you.

TotalYTD = 
TOTALYTD(SUM(Table[Amount]), Date[Date]) 
TotalPY =
CALCULATE(
    [TotalYTD], 
      DATEADD(Date[Date], -1 , YEAR)
)

 

Just add the Category to a visual and both measures. Use the Columns from the Date table in all visuals and slicers.

 

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn


Let's connect on LinkedIn


Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors