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
Greenwoodr
Helper I
Helper I

measure values same on each row

Hi, 

 

I have an issue around the context of calculated measures which I am struggling to get my head around.

 

I have the following

 

1. Fact table (sales)

    Customer ID

    Date ID

    ProductID

    Leads Flag (0,1)

    Sales Flag (0,1)

2. Date Dimension

    DateID

   [Various date variables]

3. Seller Table

   SellerID

 Sellers Name

4. Customer table

   CustomerID

   PhoneNumberFlag (contains 0s & 1s)

 

   This allows me to create the following table by product and date range (i.e Weeknum):

 

Seller       Count leads    count Sale     Percentage(measure)

Bob             10                    8                      80%

Dave             2                     1                      50

 

measure = Sum(sales)/sum(leads)

 

I need to know how many leads have a phone number  . However when I do this I get the same answer across all rows of the table and am therefore igoring the filter context of the table

 

Seller       Count leads    count Sale     Percentage(measure)    sum of PhoneNumberFlag

Bob             10                    8                      80%                               80000

Dave             2                     1                      50                                 80000

 

sum of PhoneNumberFlag = calculate(sum('Customer table'[PhoneNumberFlag]))

 

How do I ensure this measure is in the context of the Table in the report?

 

Many Thanks

 

1 ACCEPTED SOLUTION

Hi,

 

I have been playing and Cross directional filtering on the customer table seems to give me the right answer.

Thanks for your time

 

View solution in original post

8 REPLIES 8
themistoklis
Community Champion
Community Champion

@Greenwoodr

 

CALCULATE function needs to be used in combination with a FILTER or All/Allexcept/Allselected function.

 

Any chance to share the file with us or send us some sample data and the expected output?

 

e.g.

PhoneNumberFlag = calculate(sum('Customer table'[PhoneNumberFlag]), ALLEXCEPT('Seller Table', 'Seller Table'[Seller Name]))

Fact TableFact TableOther TablesOther TablesOther TablesOther TablesBI DesignBI DesignActual OutputActual OutputIDesired OutputDesired Output

Hi,

 

I have been playing and Cross directional filtering on the customer table seems to give me the right answer.

Thanks for your time

 

Hi,

 

I have been playing and Cross directional filtering on the customer table seems to give me the right answer.

Thanks for your time

 

Fact TableFact TableOther TablesOther TablesOther TablesOther TablesBI DesignBI DesignActual OutputActual OutputIDesired OutputDesired Output

Thanks. 

 

I have recreated the problem and put the tables data in Excel - what is the best way to share it?

Richard

@Greenwoodr

 

You can use dropbox, onedrive, googledrive,.... or e.g. wetransfer.com

I have put some screen shots of the problem if that helps.

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.