SSAS tabular model - Get the latest data row based on the Select date hierarchy

Bernard CP Raj 1 Reputation point
2022-08-18T14:49:47.04+00:00

Hi All,

I am new to SSAS tabular model hoping for a solution following problem;

This my data set
![232439-image.png]2

On the basis of select in Date hierarchy, cube need to retrieve the entire latest row

For example ;

IF Year ALL was selected
232514-image.png

IF 2020 Quarter 1 was selected 232542-image.png

OR the month March'2020 was Selected

232475-image.png

Looking select the latest row for selected Date hierarchy

Thanking you in advance

SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alexei Stoyanovsky 3,416 Reputation points
    2022-08-22T06:14:49.43+00:00

    Finding the latest date within the current user's selection is as simple as var maxd = MAX('Table'[Date])
    A bigger problem is the logic for when there're several rows for this date.
    And the biggest problem is that DAX measures don't return rows - they return single values. So to reproduce your whole row in a say pivot table you'll have to create a measure for each of the columns. Or perhaps you'll be able to list the columns in some helper column elsewhere, put it on pivot table's columns axis and author a clever single measure that'll get the value corresponding to the column's name.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.