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.
Hello,
I have a very large dataset with multiple entries per account per year. I need to pull a text variable (contractor) into a new table based on the last year in the dataset. The issue is that I have multiple entries for the same year for the same account. The variable I need to pull (contractor) is always consistent for a given year. I first tried using LASTNONBLANK , but the data set is not sorted by year, so I do not always have the correct result. Is there a way I can combine a formula with MAX on the year to filter and LASTNONBLANK?
Thank you in advance.
Solved! Go to Solution.
May be a MEASURE like this
LastContractor = CALCULATE ( MAX ( Table1[Contractor] ), FILTER ( Table1, Table1[Year] = MAX ( Table1[Year] ) ) )
Hi,
For a smaller dataset, could you show the input Tables and desired output.
Hi,
Share the link from where i can download your Excel file.
May be a MEASURE like this
LastContractor = CALCULATE ( MAX ( Table1[Contractor] ), FILTER ( Table1, Table1[Year] = MAX ( Table1[Year] ) ) )
Works perfectly. Thank you so much!
Why dont you Sort it by Year and add a Index Column Starting with 1 and increment by 1 in Power Query and then use something like :
CALCULATE(LASTNONBLANK(TABLE1(COLUMN,1),FILTER(TABLE1,TABLE 1INDEX = MIN(TABLE1INDEX)))
Thanks for the reply. Was able to sort and create the index, However, when I tried the DAX below
CALCULATE(LASTNONBLANK(TABLE1(COLUMN,1),FILTER(TABLE1,TABLE 1INDEX = MIN(TABLE1INDEX)))
It pulls the data associated with 1 in the Index column. For example, the new calculated column is always "AA" (which is the contractor indexed at 1).
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |