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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Krishnan_47
Helper I
Helper I

Dynamic Header Date value in matrix table

Hi,

 

I have the following data as shown in the screenshot:

Data.PNG

When user selects a particular date, I need to show current month and previous month data as shown below using a matrix table, the only challenge I am facing is that am not able to show date values in column headers. Is there a way to show date values in column headers of a matrix visual? 

 

Expected.PNG

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

Hi @Krishnan_47 

You can create a measure to realize your need .

(1)Create a calculated table to return the date column from original data table, and add a slicer with the column 'Table 2'[Date]

Table 2 = SELECTCOLUMNS('Table',"Date",'Table'[Date])

(2)Create a measure to return current month and previous month data when you select date in slicer .

select month value = CALCULATE(SELECTEDVALUE('Table'[Value]),FILTER('Table','Table'[Date]<=SELECTEDVALUE('Table 2'[Date]) && 'Table'[Date]>=DATEADD('Table 2'[Date],-1,MONTH)))

(3)Add the measure to values in Matrix visual .

Ailsamsft_0-1642490578384.png

Final result is as shown :

Ailsamsft_1-1642490578387.png

Ailsamsft_2-1642490578389.png

I have attached my pbix file , you can refer to it.

 

Best Regard

Community Support Team _ Ailsa Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yetao1-msft
Community Support
Community Support

Hi @Krishnan_47 

I tried the extra scene you mentioned, but unfortunately, it can't be implemented in Matrix at the moment .

I calculated the current value and previous value and then subtracted , but the value display in each row . That means you cannot display the month dynamic with the month slicer .

Ailsamsft_0-1642668024138.png

Moreover, Matrix does not support dynamic hidden null values, and can only be manually dragged. This does not meet the dynamic display you require. So it is impossible for you to add more dynamic measures .

 

Best Regard

Community Support Team _ Ailsa Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yetao1-msft
Community Support
Community Support

Hi @Krishnan_47 

You can create a measure to realize your need .

(1)Create a calculated table to return the date column from original data table, and add a slicer with the column 'Table 2'[Date]

Table 2 = SELECTCOLUMNS('Table',"Date",'Table'[Date])

(2)Create a measure to return current month and previous month data when you select date in slicer .

select month value = CALCULATE(SELECTEDVALUE('Table'[Value]),FILTER('Table','Table'[Date]<=SELECTEDVALUE('Table 2'[Date]) && 'Table'[Date]>=DATEADD('Table 2'[Date],-1,MONTH)))

(3)Add the measure to values in Matrix visual .

Ailsamsft_0-1642490578384.png

Final result is as shown :

Ailsamsft_1-1642490578387.png

Ailsamsft_2-1642490578389.png

I have attached my pbix file , you can refer to it.

 

Best Regard

Community Support Team _ Ailsa Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you Ailsa-msft. I have one more additional clarifcation. Please let me know if it is possible to achieve the following scenarios:

1. Can we add a new column 'Diff' for each Asset? The formula for diff will be (Current Month - Prev Month).

2. Can we show Total in column level.

 

Please find below screenshot highlighted in yellow for the two points:

Expected.PNG

mahoneypat
Employee
Employee

I don't think you can put it on your header rows like that, but you could create a measure that dynamically creates the selected and previous month as a text string and use that in the Title of the matrix. Click on fx button and use that measure. Alternatively you could create two measures (selected and prev month), put those in card visuals and place them where you want on the report near your matrix.

 

mahoneypat_0-1642256649017.png

 

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


You can have multiple levels for the columns. You just need to drill down a level.

 

AlexisOlson_1-1642268658856.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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