Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I've got a Matrix with months in the column header and days in the row header and the value are the items count.
For the 138 value on ene column and 1 row, i need to get the SUM of 138 and the previous value 537. And the recursively...
How can i do it?
Solved! Go to Solution.
Hey @marcss44 ,
here you go:
TotalValue Of DistinctCounts =
SUMX(
ALLSELECTED( 'TablaDifDias'[Value] )
, [Some kind of DistinctCount]
)
Regards,
Tom
Hi @marcss44 ,
Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.
If these also don't help, please share more detailed information and description to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
He @marcss44 ,
I do not download from we transfer, I'm sorry.
Regards,
Tom
Sorry, from google Drive: https://drive.google.com/file/d/1bWSzMQ3p2vp2ZqH5fq5CuTLXGfXsbCNg/view?usp=sharing
Hey @marcss44 ,
based on your sample data I use two measures to create the Matrix visual:
The DISTINCTCOUNT measure:
Some kind of DistinctCount =
COUNTROWS(
VALUES( 'SDFSDG'[PEDIDO] )
)
The RunningSum measure:
RunningSum Of DistinctCounts =
[Some kind of DistinctCount]
+
SUMX(
WINDOW(
1 , abs
, -1 , rel
, SUMMARIZE(
ALLSELECTED( 'TablaDifDias'[Value] )
, 'TablaDifDias'[Value]
)
, ORDERBY( 'TablaDifDias'[Value] , ASC )
)
, [Some kind of DistinctCount]
)
And the Matrix visual:
The screenshot reveals an implicit challenge/isssue of RunningSums calculations. If you do not want to have a running sum calculated for days that do not have DISTINCTCOUNT then you can use the below measure:
smarter RunningSum Of DistinctCounts =
var currentDistinctCount = [Some kind of DistinctCount]
return
IF( NOT(ISBLANK( currentDistinctCount ) )
, currentDistinctCount
+
SUMX(
WINDOW(
1 , abs
, -1 , rel
, SUMMARIZE(
ALLSELECTED( 'TablaDifDias'[Value] )
, 'TablaDifDias'[Value]
)
, ORDERBY( 'TablaDifDias'[Value] , ASC )
)
, [Some kind of DistinctCount]
)
)
Hopefully, this provides what you are looking for.
Regards,
Tom
Yeah it works, and the lasti, how can i get the sum of all values in evrey column, for example 771 for the first column, 879 for the second...
Hey @marcss44 ,
here you go:
TotalValue Of DistinctCounts =
SUMX(
ALLSELECTED( 'TablaDifDias'[Value] )
, [Some kind of DistinctCount]
)
Regards,
Tom
Hey @marcss44
please create a pbix that contains sample data but still reflects your semantic model (tables, relationships, calculated columns, and measures). Upload the pbix to OneDrive, Google Drive, or Dropbox and share the link.
Regards,
Tom
Hey @marcss44 ,
assuming the table looks like this (I only entered a couple of values):
You can use the below measure to achieve what you want:
Measure =
CALCULATE( SUM( 'Table'[value] ) )
+ CALCULATE(
SUM( 'Table'[value] )
, WINDOW(
1 , abs
, -1 , rel
, SUMMARIZE(
ALLSELECTED( 'Table'[day_diff] )
, 'Table'[day_diff]
)
, ORDERBY( 'Table'[day_diff] , ASC )
)
)
The measure is leveraging the windowing function WINDOW (WINDOW – DAX Guide😞
The Matrix visual will look like this:
I also wrote an article why WINDOW is my favorite windowing function: My favorite windowing function - WINDOW - Mincing Data - Gain Insight from Data (minceddata.info)
Hopefully, this provides what you are looking for, to tackle your challenge.
Regards,
Tom
Just one step more, the value is the distinctcount of invoices not direct value
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
User | Count |
---|---|
91 | |
89 | |
79 | |
69 | |
68 |
User | Count |
---|---|
222 | |
128 | |
117 | |
82 | |
77 |