• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Calculated Measure - Based on Two Columns |Power Pivot|Excel Forum|My Online Training Hub

You are here: Home / Calculated Measure - Based on Two Columns |Power Pivot|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower PivotCalculated Measure - Based on Two C…
sp_PrintTopic sp_TopicIcon
Calculated Measure - Based on Two Columns
Avatar
Sid Jones
Member
Members
Level 0
Forum Posts: 11
Member Since:
April 15, 2021
sp_UserOfflineSmall Offline
1
July 16, 2022 - 6:43 am
sp_Permalink sp_Print

I'm working on creating an excel dashboard with power pivots/charts.   The data set is for opportunities and contains data such as Business Sector, Operating Group, Opportunity ID, Opportunity Name, Status Reason, and Expected RFP date.   These are column headers. 

I created a measure that counts rows based on text contained within the Status Reason column for "In Progress".  This is the measure I used:

=CALCULATE(COUNTROWS(TABLE),TABLE[COLUMN] = "TEXT")

*actual measure*
=CALCULATE(COUNTROWS(Opportunities), Opportunties[Status Reason] = "In Progress")

This gave me what I needed, but I then realized I needed to filter is down once more based on the Expected RFP date.   My data has rows missing dates in that column, so I need to count all rows with a "In Progress" status but filter out those rows missing a date with that status.  I, for the life of my, can not get this to work. 

I would normally use Power Query to filter out those rows, but I need the data in other columns for those as having that info triggers actions for people to go back to our system of record and input missing info (dates). 

 

Help - Thanks

sp_AnswersTopicSeeAnswer See Answer
Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4450
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
2
July 16, 2022 - 10:23 am
sp_Permalink sp_Print

Hi Sid,

Have you tried adding a filter to calculate for && NOT(ISBLANK([date]))

Mynda

Avatar
Sid Jones
Member
Members
Level 0
Forum Posts: 11
Member Since:
April 15, 2021
sp_UserOfflineSmall Offline
3
July 16, 2022 - 10:51 am
sp_Permalink sp_Print

Hi Mynda,

I have not, but I will.    

I did try this measure, and it appears it works, but I'm not 100%.   

=CALCULATE(COUNTROWS(Opportunities), FILTER(Opportunities, Opportunties[Status Reason] = "In Progress"),Opportunties[RFP Date - Expected]>DATE(1950,1,1))

Once I double-click the calculated number in the pivot table and then filter to double-check the count, in some cases, it matches the calculated amount, and in others, the pivot count is greater than I would have expected based on my manual filtering count. 

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4450
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
4
July 16, 2022 - 8:45 pm
sp_Permalink sp_Print sp_EditHistory

Hi Sid,

The formula isn't written correctly. If your criteria are AND, you must separate them with && e.g.

=CALCULATE(COUNTROWS(Opportunities), Opportunties[Status Reason] = "In Progress" && Opportunties[RFP Date - Expected]>DATE(1950,1,1))

 

Mynda

Avatar
Sid Jones
Member
Members
Level 0
Forum Posts: 11
Member Since:
April 15, 2021
sp_UserOfflineSmall Offline
5
July 19, 2022 - 4:40 am
sp_Permalink sp_Print

I can't believe these problem is stumping me so much.  Below are the two options I have tried to 1) count rows based on a status that also contains a date in the expected RFP date column.   Essentially, only counts rows with a date in one column and a status of "in progress" in another. 

I believe either formula below should result in the same answer, but I receive this error for the first tone:

"Calculation error in measure 'Opportunities'[Test InProg]: The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression."

And I receive this error don't the second.

"Failed to resolve name 'Opportunities'. It is not a valid table, variable, or function name."

When I rewrite the name to fix that, I then get the same error as the first one.   So frustrating!! 

 

1st Formula 

=CALCULATE(COUNTROWS(Opportunties), Opportunties[Status Reason] = "In Progress" && NOT(ISBLANK(Opportunties[RFP Date - Expected])))

 

2nd Formula

=CALCULATE(COUNTROWS(Opportunities), Opportunties[Status Reason] = "In Progress" && Opportunties[RFP Date - Expected]>DATE(1950,1,1))
Avatar
Sid Jones
Member
Members
Level 0
Forum Posts: 11
Member Since:
April 15, 2021
sp_UserOfflineSmall Offline
6
July 19, 2022 - 5:03 am
sp_Permalink sp_Print sp_EditHistory

Fairly certain i resolved my issue with this formula. 

 

Countrow of the table and then filter based on status and a > than date. 

 

=CALCULATE(COUNTROWS(Opportunities),FILTER(Opportunities,Opportunities[Status Reason]="In Progress" && Opportunities[RFP Date - Expected]>DATE(1950,1,1)))

 

Thanks a million, Mynda, for the help! 

sp_AnswersTopicAnswer
Answers Post
Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4450
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
7
July 19, 2022 - 9:32 am
sp_Permalink sp_Print

Glad you go there in the end, Sid. Tenacity will get you a long way

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online:
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
Jessica Stewart: 205
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
stuart burge
Bruce Tang Nian
Scot C
Othman AL MUTAIRI
Misael Gutierrez Sr.
Attif Ihsan
Kieran Fee
Murat Hasanoglu
Brett Dryland
Saeed Aldousari
Forum Stats:
Groups: 3
Forums: 24
Topics: 6223
Posts: 27295

 

Member Stats:
Guest Posters: 49
Members: 31920
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.