The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
Can someone please help with converting the following two sql into dax:
1) StartDate <= @reportenddate and EndDate is null
or EndDate <> null or StartDate <= @reportenddate and EndDate >= @reportstartdate)
2) (EndDate between @reportstartdate and @reportenddate)
Kudos for your help.
Thank you in advance.
Solved! Go to Solution.
@matrix_user Maybe:
Column =
VAR __reportenddate = <some date I guess> // ?? where is this coming from?
VAR __reportstartdate = <some date I guess> // ?? where is this coming from?
RETURN
IF(
( [StartDate] <= __reportenddate && [EndDate] = BLANK() ) || [EndDate] <> BLANK() || ( [StartDate] <= __reportenddate && [EndDate] >= __reportstartdate),
TRUE(),
FALSE()
)
Usually this is far easier to just post sample data as text and expected output.
Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
@matrix_user Maybe:
Column =
VAR __reportenddate = <some date I guess> // ?? where is this coming from?
VAR __reportstartdate = <some date I guess> // ?? where is this coming from?
RETURN
IF(
( [StartDate] <= __reportenddate && [EndDate] = BLANK() ) || [EndDate] <> BLANK() || ( [StartDate] <= __reportenddate && [EndDate] >= __reportstartdate),
TRUE(),
FALSE()
)
Usually this is far easier to just post sample data as text and expected output.
Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
User | Count |
---|---|
26 | |
12 | |
8 | |
8 | |
5 |
User | Count |
---|---|
28 | |
13 | |
12 | |
12 | |
6 |