Forum Discussion
hmattje
3 years agoFrequent Visitor
Challenge - Count most recent rows for each Dataset - filtered by a date slicer
Hi All, I need help to create a measure in dax. My problem is I need to create a bar chart to show Count of "Columns" by "Category" it is simple, but I need to only count columns of latest records...
- 3 years ago
Thanks for your reply
I managed to do it using this measure belowSUMX( ADDCOLUMNS( VALUES(Registration[Dataset]), "Count", VAR vDataMax = CALCULATE( MAX(Registration[Date]), ALLEXCEPT(Registration, Registration[Dataset]), 'Date'[Date] >= MIN('Date'[Date]) && 'Date'[Date] <= MAX('Date'[Date]) ) RETURN COUNTROWS( FILTER( SUMMARIZE( Registration, Registration[Date], Registration[Dataset], Registration[Column], Registration[Type] ), Registration[Date] = vDataMax ) ) ), [Count] )
amitchandak
Super User
3 years agohmattje , refer if these can help
Latest
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0
hmattje
3 years agoFrequent Visitor
Thanks for your reply
I managed to do it using this measure below
SUMX(
ADDCOLUMNS(
VALUES(Registration[Dataset]),
"Count",
VAR vDataMax =
CALCULATE(
MAX(Registration[Date]),
ALLEXCEPT(Registration, Registration[Dataset]), 'Date'[Date] >= MIN('Date'[Date]) && 'Date'[Date] <= MAX('Date'[Date])
)
RETURN
COUNTROWS(
FILTER(
SUMMARIZE(
Registration,
Registration[Date],
Registration[Dataset],
Registration[Column],
Registration[Type]
),
Registration[Date] = vDataMax
)
)
),
[Count]
)