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 dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have the following table
DateTransaction | DateForecast | Amount | Type |
01/01/2010 | 03/01/2010 | 100 | A |
I want to show the Amount where there is a lag of 2 months and the type = A.
The SQL for this would be (but I'm not sure what the DAX would be):
SELECT Amount from table
WHERE
Datetransaction = Dateadd(month,2,DateForecast)
and type = 'A'
Try like
measure =
calculate(sum(Table[Amount]), filter(all(Table),DATEDIFF(Table[DateTransaction],Table[DateForecast],Month)>=2 && Table[Type] ="A"))
Hi @Anonymous
or create a new table
NewTable =
FILTER(ALL(Table),
DATEDIFF(Table[DateTransaction], Table[DateForecast], MONTH) = 2 && Table[Type] = "A"
)
Hi @Anonymous ,
You can create a column in your data and use it as flag on your report:
IsAmountBasedOnLag = IF( table[Datetransaction] = DATEADD(table[DateForecast], 2, month), table[Amount] && table[Type] = "A", 1, 0)
The above dax expression creates a flag with 1 or 0 values in it. If your condition is met it is 1, esle it is 0.
On you report, add a report level filter for IsAmountBasedOnLag = 1. This will display relevant details as required.
NOTE: Replace table in above DAX with your table name.
If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂
Thanks,
Pragati
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
7 | |
7 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |