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
Anonymous
Not applicable

Applying Calculated Measure within another Measure

Hi,

 

I previously created two measures (with the help on this community!!). The purpose of the first measure was to find the days between the most recent entry in the table and a fixed date. The second measure was to use the days between to determine the date range between the fixed date and the most recent entry. Both measures worked well for my purpose. This is detailed below:

Days Between = calculate( countrows(date_table), DATESBETWEEN( date_table[Date_field].[Date], date(2020,11,01),
MAX(tblInvestigations[Date Received])))
 
Rolling Measure Before = CALCULATE(COUNTROWS(tblInvestigations),DATESINPERIOD(date_table[Date_field],date(2020,11,01),-[Days Between],DAY))
 
 
I wanted to integrate  [Rolling Measure Before] into another measurement with the aim of filtering for this new  date range. I tried the below and it gave me blanks with no error. Removing the [Rolling Measure Before] measure populated the card indicating the the [Date Recieved] = [Rolling Measure Before] part isn't working properly.

External (Before) =calculate(countrows(tblInvestigations),
FILTER( tblInvestigations, [Date Received] = [Rolling Measure Before] && [Col_1 ] <> BLANK() &&
[Col_1] <> "N/A"))
 
I would appreciate any advice or directions!
 
Cheers
4 REPLIES 4
Anonymous
Not applicable

Hi Amit, Sorry for the late reply was on break. 

Your post managed to spark me to try something new which was to take out the measure from the filter and apply it next to the count rows like this:

 

CALCULATE(COUNTROWS
(tblInvestigations),DATESINPERIOD(date_table[Date_field],date(2020,11,01),-[Days Between],DAY),
FILTER(tblInvestigations,[Column_1] = "X"))



Thanks!

amitchandak
Super User
Super User

@Anonymous ,You are comparing

[Date Received] = [Rolling Measure Before]

I doubt Rolling measure Before do not return date.

 

what you want to achieve here, you can for isblank( [Rolling Measure Before])

 

or

 

not isblank( [Rolling Measure Before])

 

Anonymous
Not applicable

Hi Amit,
Did you mean inside the filter like this or outside?

External (Before) =
calculate(countrows(tblInvestigations), FILTER( tblInvestigations, NOT(ISBLANK([Rolling Measure Before])) && [Col_1 ] <> BLANK() && [Col_1 ] <> "N/A")))

This returns blanks and removing the NOT part is the same as removing the [Rolling Measure Before] part.

@Anonymous , the measure seems correct.

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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.

Top Solution Authors