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
albatross19
Frequent Visitor

Creating a column from a Measure

Hi everyone!

 

I want to be able to calculate the maximum number of calls that happen on a given day within a date range. I am using a simple 

 

 

CALCULATE(COUNT(DNIS))

 

 

 To obtain the number of calls that come from a specific number on a given day. 

 

The table that I want to add the Max Quantity of calls  looks like this:

CampaignMail Drop DateQuantity
August2020-08-28 
October2020-10-05 
November2020-11-15 

 

The table that I am getting my call volume looks like this:

Datephonenumberquality call
2020-09-0980011111111
2020-09-0980011111110
2020-09-1080011111111
2020-10-0680011111120
2020-10-0680011111121
2020-10-0680011111110
2020-11-1880011111111

 

To enhance the challenge here, the days to take into account should be contraint by the mail drop date.. How can I create a function or write code to make it happen? We can add an additonal column to the first table with a Mail Drop End Date base on the date of the row below from the Mail Drop Date column.

 

I really appreciate any insights! 

 

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @albatross19

 

Not sure whether I have caught your meaning,see the method below:

Create 2 columns as below:

Related date = CALCULATE(MIN('Table (2)'[Mail Drop Date]),FILTER('Table (2)','Table (2)'[Mail Drop Date]>EARLIER('Table'[Date])))
Date Quantity = CALCULATE(COUNT('Table'[quality call]),FILTER('Table','Table'[Related date]=EARLIER('Table (2)'[Mail Drop Date])))+0

And you will see:

Capture.PNG

For the related .pbix file,pls see attached.

 
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi @albatross19

 

Not sure whether I have caught your meaning,see the method below:

Create 2 columns as below:

Related date = CALCULATE(MIN('Table (2)'[Mail Drop Date]),FILTER('Table (2)','Table (2)'[Mail Drop Date]>EARLIER('Table'[Date])))
Date Quantity = CALCULATE(COUNT('Table'[quality call]),FILTER('Table','Table'[Related date]=EARLIER('Table (2)'[Mail Drop Date])))+0

And you will see:

Capture.PNG

For the related .pbix file,pls see attached.

 
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

@v-kelly-msftThank you!

 

This looks pretty similar to the outcome I was expecting!

Greg_Deckler
Super User
Super User

@albatross19 Sorry, having trouble following this. You do not want to create a column from a measure typically since measures are dynamic and calculated columns are not. This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.


Otherwise, 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.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.