Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello, everyone
First off, I'd like to admit that I'm not well versed in DAX. So, there might be a simpler process.
I have a request to simulate the below SQL Server query using a dynamic date in Power BI. Essentially, the most recent time that a "UniqueID" is used on or before a specific date.
WITH cte_test AS (
SELECT *, ROW_NUMBER() OVER (PARTITION BY UniqueID ORDER BY workDate desc) AS ROWID
FROM table1
WHERE workDate <= '2023-11-01'
)
SELECT max(workDate) AS workDate, status, count(UniqueID) AS countUniqueID, sum(AMOUNT_DUE) AS AMOUNT_DUE, sum(PRINCIPAL_AMOUNT) AS SUM_PRINCIPAL_AMOUNT, sum(INTEREST_AMOUNT) AS sum_INTEREST_AMOUNT
FROM cte_test
WHERE ROWID = 1
GROUP BY status;
I was able to get the data to come in as expected using the following DAX and a multiple select box. The user wants the ability to change the date with the select box and update the data to use the new date as the "origin".
rwDateRank = ROWNUMBER(
ALLSELECTED(impData[DWORK_OF_DATE],impData[LOAN_ID])
,ORDERBY(
'impData'[DWORK_OF_DATE],DESC
)
, DEFAULT
, PARTITIONBY('impData'[LOAN_ID])
)
The issue I am running into is that I cannot aggregate the values by Status. If I remove the Unique ID or Work Date, the data disappears and only shows the headings.
I need to aggregate the data to show something like the below.
Anyone have any suggestions?
ROWNUMBER IN DAX IS GARBAGE.
Hi @tdewitt274 ,
Please provide some sample date and can you explain how these figures were calculated?
I need to know the formula to find the DAX for you.
Best Regards,
Dino Tao
Hello, Dino
These are just COUNT and SUM the "columns" section of the "Build visual" section.
Thanks,
Todd
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
15 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
22 | |
11 | |
10 | |
10 | |
8 |