Forum Discussion
Sophisticated Dashboard requirements - need help
Hello Team!
I need to prepare the report based on the following requirements:
There is a matrix that shows names as rows, YearMonth as columns, Sum of Value as Values.
- Based on YearMonth slicer, select only YearMonths backwards from the selected one. Ex. If I choose March, I would like to see January-March, if October, January-October.
- Select top 15 names based on the value from the selected month. Ex. I choose March, I get 15 top names based on the sum value for March – still have January-March data as in the above requirement.
- Modify colors of cells based on values from months, green color when value increases month-to-month and red one when values decrease ( in the static measure there a gray color as “else” but it is not relevant now).
The following screen shows solution by static measures.
I am attaching measure example and color measure example:
Value February 2025 =
CALCULATE(
SUM(Final_table[value]),
'Date table'[YearMonth] = "2025-02")
Feb 2025 Color =
VAR Current_Period = [Value February 2025]
VAR Previous_Period = [Value January 2025]
RETURN
SWITCH(
TRUE(),
ISBLANK(Current_Period) || ISBLANK(Previous_Period), BLANK(),
Current_Period > Previous_Period, "Light Green",
Current_Period < Previous_Period, "Red",
"Gray"
)
I put a filter for name, top 15 based on last available month value (October 2025).
Please let me know in case of any further queries. I am attaching PowerQuery code + excel sample data.
Thanks!
| Name | Value | YearMonth |
| Alpha | 0,0579 | 2025-01 |
| Bravo | 0,0384 | 2025-02 |
| Charlie | 0,1567 | 2025-03 |
| Delta | 0,1211 | 2025-04 |
| Echo | 0,1948 | 2025-05 |
| Foxtrot | 0,1494 | 2025-06 |
| Golf | -0,0078 | 2025-07 |
| Hotel | -0,0048 | 2025-08 |
| India | 0,0133 | 2025-09 |
| Juliet | 0,103 | 2025-10 |
| Kilo | -0,0005 | 2025-11 |
| Lima | 0,1058 | 2025-12 |
| Mike | 0,143 | 2025-01 |
| November | 0,0527 | 2025-02 |
| Oscar | 0,144 | 2025-03 |
| Papa | 0,1245 | 2025-04 |
| Quebec | 0,0363 | 2025-05 |
| Romeo | 0,0167 | 2025-06 |
| Sierra | 0,0588 | 2025-07 |
| Tango | 0,0771 | 2025-08 |
| Uniform | 0,019 | 2025-09 |
| Victor | 0,1141 | 2025-10 |
| Whiskey | 0,0678 | 2025-11 |
| Xray | 0,1151 | 2025-12 |
| Yankee | 0,1552 | 2025-01 |
| Zulu | 0,1678 | 2025-02 |
| Orion | 0,0951 | 2025-03 |
| Pegasus | 0,1812 | 2025-04 |
| Phoenix | 0,0936 | 2025-05 |
| Atlas | 0,1689 | 2025-06 |
| Alpha | 0,1625 | 2025-07 |
| Bravo | 0,0351 | 2025-08 |
| Charlie | 0,0306 | 2025-09 |
| Delta | 0,0183 | 2025-10 |
| Echo | 0,1582 | 2025-11 |
| Foxtrot | 0,1515 | 2025-12 |
| Golf | 0,0347 | 2025-01 |
| Hotel | 0,1496 | 2025-02 |
| India | 0,1455 | 2025-03 |
| Juliet | 0,1712 | 2025-04 |
| Kilo | 0,0855 | 2025-05 |
| Lima | 0,126 | 2025-06 |
| Mike | 0,059 | 2025-07 |
| November | 0,1144 | 2025-08 |
| Oscar | 0,053 | 2025-09 |
| Papa | 0,11 | 2025-10 |
| Quebec | 0,0387 | 2025-11 |
| Romeo | 0,1559 | 2025-12 |
| Sierra | 0,1067 | 2025-01 |
| Tango | 0,0732 | 2025-02 |
| Uniform | 0,0171 | 2025-03 |
| Victor | 0,1767 | 2025-04 |
| Whiskey | 0,1411 | 2025-05 |
| Xray | 0,0931 | 2025-06 |
| Yankee | -0,0044 | 2025-07 |
| Zulu | 0,1506 | 2025-08 |
| Orion | 0,1076 | 2025-09 |
| Pegasus | 0,1522 | 2025-10 |
| Phoenix | 0,0318 | 2025-11 |
| Atlas | 0,1852 | 2025-12 |
| Alpha | 0,1547 | 2025-01 |
| Bravo | 0,1009 | 2025-02 |
| Charlie | 0,034 | 2025-03 |
| Delta | 0,1335 | 2025-04 |
| Echo | 0,1794 | 2025-05 |
| Foxtrot | 0,1158 | 2025-06 |
| Golf | -0,0049 | 2025-07 |
| Hotel | 0,0713 | 2025-08 |
| India | 0,0994 | 2025-09 |
| Juliet | 0,1756 | 2025-10 |
| Kilo | 0,0283 | 2025-11 |
| Lima | 0,093 | 2025-12 |
| Mike | 0,1939 | 2025-01 |
| November | 0,102 | 2025-02 |
| Oscar | 0,0476 | 2025-03 |
| Papa | 0,1635 | 2025-04 |
| Quebec | 0,0123 | 2025-05 |
| Romeo | 0,0776 | 2025-06 |
| Sierra | 0,1149 | 2025-07 |
| Tango | 0,0651 | 2025-08 |
| Uniform | 0,1665 | 2025-09 |
| Victor | 0,1713 | 2025-10 |
| Whiskey | 0,1847 | 2025-11 |
| Xray | 0,1195 | 2025-12 |
| Yankee | 0,0975 | 2025-01 |
| Zulu | 0,084 | 2025-02 |
| Orion | 0,1284 | 2025-03 |
| Pegasus | 0,0302 | 2025-04 |
| Phoenix | 0,1829 | 2025-05 |
| Atlas | 0,0395 | 2025-06 |
| Alpha | 0,152 | 2025-07 |
| Bravo | 0,0953 | 2025-08 |
| Charlie | 0,1239 | 2025-09 |
| Delta | 0,0562 | 2025-10 |
| Echo | 0,133 | 2025-11 |
| Foxtrot | 0,0574 | 2025-12 |
| Golf | 0,1282 | 2025-01 |
| Hotel | 0,0029 | 2025-02 |
| India | 0,0567 | 2025-03 |
| Juliet | 0,0529 | 2025-04 |
| Kilo | 0,1469 | 2025-05 |
| Lima | 0,1902 | 2025-06 |
| Mike | 0,1505 | 2025-07 |
| November | 0,1095 | 2025-08 |
| Oscar | 0,0795 | 2025-09 |
| Papa | 0,1887 | 2025-10 |
| Quebec | 0,1397 | 2025-11 |
| Romeo | 0,0045 | 2025-12 |
| Sierra | 0,1733 | 2025-01 |
| Tango | 0,0359 | 2025-02 |
| Uniform | 0,0525 | 2025-03 |
| Victor | 0,1044 | 2025-04 |
| Whiskey | 0,1882 | 2025-05 |
| Xray | 0,0679 | 2025-06 |
| Yankee | 0,1297 | 2025-07 |
| Zulu | 0,1094 | 2025-08 |
| Orion | 0,1768 | 2025-09 |
| Pegasus | 0,0128 | 2025-10 |
| Phoenix | 0,1622 | 2025-11 |
| Atlas | 0,1039 | 2025-12 |
| Alpha | 0,139 | 2025-01 |
| Bravo | 0,0056 | 2025-02 |
| Charlie | 0,0651 | 2025-03 |
| Delta | 0,0305 | 2025-04 |
| Echo | 0,1001 | 2025-05 |
| Foxtrot | 0,0498 | 2025-06 |
| Golf | 0,1665 | 2025-07 |
| Hotel | 0,067 | 2025-08 |
| India | 0,1724 | 2025-09 |
| Juliet | 0,0167 | 2025-10 |
| Kilo | 0,1186 | 2025-11 |
| Lima | 0,0175 | 2025-12 |
| Mike | 0,1252 | 2025-01 |
| November | 0,1828 | 2025-02 |
| Oscar | 0,0028 | 2025-03 |
| Papa | 0,0566 | 2025-04 |
| Quebec | 0,0808 | 2025-05 |
| Romeo | 0,0863 | 2025-06 |
| Sierra | -0,0007 | 2025-07 |
| Tango | 0,0959 | 2025-08 |
| Uniform | 0,0916 | 2025-09 |
| Victor | 0,0516 | 2025-10 |
| Whiskey | 0,0306 | 2025-11 |
| Xray | 0,1459 | 2025-12 |
| Yankee | 0,1371 | 2025-01 |
| Zulu | 0,1315 | 2025-02 |
| Orion | 0,0575 | 2025-03 |
| Pegasus | 0,1359 | 2025-04 |
| Phoenix | 0,0456 | 2025-05 |
| Atlas | 0,1533 | 2025-06 |
Hi bartek_pepper ,
I can't replicate the scenario based on your pbix file, because your pbix pulling data from your local datasource. Please refer below error.
That's the reason i have created sample pbix file based on your sample data. Please refer below snap.
Please refer below output snap and attached pbix file.
I hope this information helps. Please do let us know if you have any further queries.
Regards,
Dinesh
10 Replies
- amitchandak
Super User
bartek_pepper , if you need Date range more than selected, you need a disconnected Date table either in the slicer or the Axis(Column of the Matrix)
You need to measure like belowCALCULATE([net New], KEEPFILTERS(TOPN(5, ALLSELECTED('Item'[Brand]),[Net], DESC)))
Here one net is dependent on slicer value and another net on axis value. The measure will be decided based on the approach we takeI have discussed the approach here
- bartek_pepper
Helper I
Hi Amit,
Thank you for your suggestion.
Could you please specify what is inside [Net] and [Rolling 12] from your video?
I am not sure what steps should be taken to get the desired outcome.
Thanks.
- FBergamaschi
Super User
Hi bartek_pepper,
here my insights for each request:
There is a matrix that shows names as rows, YearMonth as columns, Sum of Value as Values.
- Based on YearMonth slicer, select only YearMonths backwards from the selected one. Ex. If I choose March, I would like to see January-March, if October, January-October.
FB You need a disconnected table showing the year-months:
Modeling -> New TableSelection=
ALL ( 'Date[Year-Month] )
Then the measure will have the code
Calculation=
VAR SelectedMonth = SELECTEDVALUE ( Selection[Year-Month] )RETURN
SUMX (
VALUES ( 'Date[Year-Month] ),
IF (
'Date[Year-Month] <= SelectedMonth,SUM ( Table[Value] )
)
supposing 'Date' is your dates table and Table[Value] is the column to aggregate
- Select top 15 names based on the value from the selected month. Ex. I choose March, I get 15 top names based on the sum value for March – still have January-March data as in the above requirement.
FB where and how do you want to see this list of Customers? In a string on a Card, or ?
CONCATENATEXTOPN (
15,
SUMMARIZE ( VALUES ( Customer), Customer[Customer key ), Customer[CustomerName] ),
SUM ( Table[Value] )
),
Customer[Customer key] & " " & Customer[CustomerName],
" / "
)- Modify colors of cells based on values from months, green color when value increases month-to-month and red one when values decrease ( in the static measure there a gray color as “else” but it is not relevant now).
FB I suggest Conditional Formatting based on this measure
Delta MoM =
[Measure] - CALCULATE ( SUM ( Table[Value] ), DATEADD ( 'Date'[Date], -1, MONTH ) )The ideal thing would be to have a Measure, say Calculation = SUM ( Table[Value] ) to avoid spreading the same code everywhere so you can reference to it in the above code instaed of refereing to SUM ( Table[Value] )
If this helped, please consider giving kudos and mark as a solution
@me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
Sincerely,
- bartek_pepper
Helper I
Hi FBergamaschi,Thank you for your input.First requirement indeed works and returns the expected result.For the second one, to make it more clear:"Select top 15 names based on the value from the selected month. Ex. I choose March, I get 15 top names based on the sum value for March – still have January-March data as in the above requirement."
It is supposed to select 15 TOP Names in the form of a table like in the first requirement - this one returns the matrix (screen below). Now I need to get 15 TOP names based on the "Value" of the selected month (As TOPN function requires a table - I got stuck here).- v-dineshya
Community Support
Hi bartek_pepper ,
Please try below steps.
1. Create SelectedMonth measures.
SelectedMonth =
SELECTEDVALUE ( Selection[Year-Month] )2. Create measure to get value in selected month
Value in Selected Month =
VAR _sel = [SelectedMonth]
RETURN
CALCULATE (
[Total Value],
'Date'[Year-Month] = _sel
)3. Create Rank Measure
Rank Top 15 =
VAR _sel = [SelectedMonth]
RETURN
RANKX (
ALLSELECTED ( Final_table[Name] ),
CALCULATE (
[Total Value],
'Date'[Year-Month] = _sel
),
,
DESC
)4. Apply this to the Matrix as a Filter.
Go to Matrix --> Filters --> Name, Add measure: Rank Top 15
If still you are facing any issue please provide sample PBIX file. we are happy to assist you.
Regards,
Dinesh
- v-dineshya
Community Support
Hi bartek_pepper ,
Thank you for reaching out to the Microsoft Community Forum.
Hi amitchandak and FBergamaschi , Thank you for your prompt responses.
Hi bartek_pepper could you please try the proposed solutions shared by amitchandak and FBergamaschi ? Let us know if you’re still facing the same issue we’ll be happy to assist you further.
Regards,
Dinesh
- bartek_pepper
Helper I
Hi v-dineshyaLet me review in the next couple of days. I just came back from short holidays.Thanks.