Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
egiam
Frequent Visitor

how to create a dax formula comparing a date in a table to a date you select from the calendar

Here is a dax formula that I put together and am stuck:

 

eg test 101 = calculate(DISTINCTCOUNT('DIM X'[X Id]), 'DIM X'[X_DC_SUBS_IND_YN] = "YES", 'DIM X'[Last App Submission Date]  ???
 
I am looking to count the distinct number of x id's that have a x_DC_SUBS_IND_YN = "YES" and I want the Last App Submission Date to not be in the month that I select. Explanation-- below you see, Month Year Name - Jan-2022, Feb-2022, Mar-2022, Apr-2022, May-2022.  I want to make sure that if I filter on Month Year Name = Jan-2022 that I"m getting a distinct count of the X id's, with X_DC_SUBS_IND_YN = "YES" but none of the ones that have a Last App Submission date within Jan-2022.  Hope this makes sense.
egiam_0-1653683022580.png

 

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @egiam ,

 

Has your problem been solved? If it is solved, please mark a reply which is helpful to you.

 

If the problem is still not resolved, please try the measure.

 

eg test 101 = 
CALCULATE (
    DISTINCTCOUNT ( 'DIM X'[X Id] ),
    FILTER (
        ALL ( 'DIM X' ),
        'DIM X'[X_DC_SUBS_IND_YN] = "YES"
            && FORMAT ( 'DIM X'[Last App Submission Date], "MMM-YYYY" )
                <> MAX ( 'Calendar'[Month Year Name] )
    )
)

vkkfmsft_0-1653986703107.png


Best Regards,
Winniz

Anonymous
Not applicable

Hi

 

Not clear with colums name but try this

Measure=

var monthyear=SELECTEDVALUE(monthyear)
calculate(DISTINCTCOUNT(filter(dimx,'DIM X'[X_DC_SUBS_IND_YN] = "YES",'DIM X'[Last App Submission Date]&date(montyear)<>monthyear)))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.