Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I have following SQL query. Could you please help me on how to check where clause in DAX. Thank
SELECT
SUM (ColAmt)
FROM Teams T
WHERE
(T.DateCol >= FisrtDateofPreviousMonth And T.DateCol <= LastDateofPreviousMonth) And
NOT Exists ( SELECT 1 FROM Teams P
Where
P.Col1 = T.Col1 And
P.DateCol >= FisrtDateofCurrentMonth And P.DateCol <= LastDateofCurrentMonth
)
Hi @Sharmi_28 , In DAX instead of Where clause Filter function can be used, try below mentioned DAX meausure
EVALUATE
VAR FirstDateofPreviousMonth = EOMONTH(TODAY(), -2) + 1
VAR LastDateofPreviousMonth = EOMONTH(TODAY(), -1)
VAR FirstDateofCurrentMonth = EOMONTH(TODAY(), -1) + 1
VAR LastDateofCurrentMonth = EOMONTH(TODAY())
RETURN
FILTER(
VALUES(T[Col1], T[Col2], T[Col3], T[DateCol]),
T[DateCol] >= FirstDateofPreviousMonth
&& T[DateCol] <= LastDateofPreviousMonth
&& NOT (
CALCULATETABLE(
VALUES(P[Col1]),
P[Col1] = T[Col1],
P[DateCol] >= FirstDateofCurrentMonth
&& P[DateCol] <= LastDateofCurrentMonth
)
)
)
Please accept as solution if it helps
Proud to be a Super User! |
|
Thanks for reply and solution.
I tried to apply your DAX but its not working for me.
I trying something like
Measure =
VAR FirstDateofPreviousMonth = EOMONTH(TODAY(), -2) + 1
VAR LastDateofPreviousMonth = EOMONTH(TODAY(), -1)
VAR FirstDateofCurrentMonth = min(DimCalendar[Date])
VAR LastDateofCurrentMonth = max(DimCalendar[Date])
RETURN
CALCULATE(
Sum(FactTable[Amount]),
FactTable[Date] >= FirstDateofPreviousMonth &&
FactTable[Date] <= LastDateofPreviousMonth
&&
NOT ( FactTable[Code]= FactTable[Code] &&
FactTable[Date] >= FirstDateofCurrentMonth && FactTable[Date] <= LastDateofCurrentMonth
)
)
But its giving error.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |