- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to convert this sql query to DAX
How to convert this sql query to DAX in a measure
Select value from KPI A
where period in (
select B.period from
Time B join period C
on B.period=c.Period
where b.quater >= c.quater-1 and b.quater <= c.quater-5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DAX measure:
Selected Value =
VAR CurrentQuarter = MAX('Period'[Quarter])
VAR FilteredPeriods =
FILTER(
ALL('Time'),
'Time'[Quarter] >= CurrentQuarter - 5 &&
'Time'[Quarter] <= CurrentQuarter - 1
)
RETURN
CALCULATE(
MAX('KPI A'[Value]),
'KPI A'[Period] IN DISTINCT(SELECTCOLUMNS(FilteredPeriods, "Period", 'Time'[Period]))
)
💌 If this helped, a Kudos 👍 or Solution mark ✅ would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, @pavithrarajan
May I ask if your problem is solved? If not resolved, can you provide sample data and your expected output? This will better describe your problem. How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this -
Measure =
CALCULATE(
SUM('KPI A'[value]),
FILTER(
'KPI A',
'KPI A'[period] IN
SELECTCOLUMNS(
FILTER(
CROSSJOIN('Time', 'period'),
'Time'[period] = 'period'[Period] &&
'Time'[quarter] >= 'period'[quarter] - 1 &&
'Time'[quarter] <= 'period'[quarter] - 5
),
"period", 'Time'[period]
)
)
)
Proud to be a Super User! | |
Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Microsoft Fabric Community Conference 2025
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
Subject | Author | Posted | |
---|---|---|---|
03-12-2024 10:29 AM | |||
09-25-2023 03:46 AM | |||
08-20-2024 07:32 AM | |||
06-26-2024 01:25 PM | |||
03-06-2024 04:36 PM |
User | Count |
---|---|
119 | |
76 | |
57 | |
56 | |
44 |
User | Count |
---|---|
183 | |
120 | |
80 | |
67 | |
57 |