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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
hainguyen28
Regular Visitor

Customized data display in matrix not shown when data is empty

I have a dashboard that shows sales in the previous 13 months of 3 categories. Each category has a different way to display the sales:

  • Furniture: Integer number
  • Office supplies: Percentage
  • Technology: Decimal

hainguyen28_0-1743012593853.png

Here is what I have for the DAX formula:

 

hainguyen28_1-1743012718196.png

 

However, if one month has missing data and I select that month in the filter, the format display is reset. For example, in the above picture, August 2012 data is missing. If I put August 2012 in the filter, all the format is automatically switched to percentage as per the picture below:

 

hainguyen28_2-1743012790240.png

What can I do to fix this?

My dashboard is here: https://drive.google.com/file/d/10zT1TsJRhfPBYNb_3DP_oOHxC2OPbikw/view?usp=sharing

 

1 ACCEPTED SOLUTION
v-pnaroju-msft
Community Support
Community Support

Thank you, @lbendlin , for your response.

Hi hainguyen28,

We appreciate your inquiry on the Microsoft Fabric Community Forum.

Please find attached the screenshot and the code, which may assist in resolving the issue:

vpnarojumsft_0-1743419249017.png

 

Total Sales Last 13 Months =

VAR SelectedMonth = MAX('Calendar'[Date])

VAR SalesAmount =

CALCULATE(

SUM(Orders[Sales]),

DATESINPERIOD(

'Calendar'[Date],

SelectedMonth,

-13,

MONTH

)

)

VAR TotalSales = [Total Sales]

VAR SalesPercentage = DIVIDE(SalesAmount, TotalSales, 0)

VAR ProductCategories = VALUES('Orders'[Product Category])

RETURN

IF(

ISBLANK(SalesAmount),

BLANK(),

CONCATENATEX(

ProductCategories,

SWITCH(

TRUE(),

'Orders'[Product Category] = "Furniture", FORMAT(SalesAmount, "#,##0"),

'Orders'[Product Category] = "Office Supplies", FORMAT(SalesPercentage, "0.00%"),

'Orders'[Product Category] = "Technology", FORMAT(SalesAmount, "0.00"),

FORMAT(SalesAmount, "0.00")

),

", "

)

)

If you find our response helpful, kindly mark it as the accepted solution and share your appreciation. This will support other community members facing similar queries.

Thank you.




View solution in original post

5 REPLIES 5
v-pnaroju-msft
Community Support
Community Support

Hi hainguyen28,

We have not received a response from you regarding the query and were following up to check if you have found a resolution. If you have identified a solution, we kindly request you to share it with the community, as it may be helpful to others facing a similar issue.

If you find the response helpful, please mark it as the accepted solution and provide kudos, as this will help other members with similar queries.

Thank you.

v-pnaroju-msft
Community Support
Community Support

Thank you, @lbendlin , for your response.

Hi hainguyen28,

We appreciate your inquiry on the Microsoft Fabric Community Forum.

Please find attached the screenshot and the code, which may assist in resolving the issue:

vpnarojumsft_0-1743419249017.png

 

Total Sales Last 13 Months =

VAR SelectedMonth = MAX('Calendar'[Date])

VAR SalesAmount =

CALCULATE(

SUM(Orders[Sales]),

DATESINPERIOD(

'Calendar'[Date],

SelectedMonth,

-13,

MONTH

)

)

VAR TotalSales = [Total Sales]

VAR SalesPercentage = DIVIDE(SalesAmount, TotalSales, 0)

VAR ProductCategories = VALUES('Orders'[Product Category])

RETURN

IF(

ISBLANK(SalesAmount),

BLANK(),

CONCATENATEX(

ProductCategories,

SWITCH(

TRUE(),

'Orders'[Product Category] = "Furniture", FORMAT(SalesAmount, "#,##0"),

'Orders'[Product Category] = "Office Supplies", FORMAT(SalesPercentage, "0.00%"),

'Orders'[Product Category] = "Technology", FORMAT(SalesAmount, "0.00"),

FORMAT(SalesAmount, "0.00")

),

", "

)

)

If you find our response helpful, kindly mark it as the accepted solution and share your appreciation. This will support other community members facing similar queries.

Thank you.




lbendlin
Super User
Super User

You can streamline your code a bit.  See if that helps

 

lbendlin_0-1743028635459.png

 

Thanks for sending this over. However, I don't think this really solved my problem. In my original graph, the user can choose the reporting month and data within the previous 12 months would show. This would be the problem if the month I choose has no data. All the formatting would disappear. Do you happen to have any other solutions that still retain my original matrix and slicer functionality?

I don't think that is a good UX. Maybe someone else can assist you further.

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors