Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
I want to return the value of column [Page Views] when the value of column [Page Name] contains "faqs".
If [Page Name] does not contain faqs anywhere in it, then 0 can be returned.
I have tried three calculated columns, none of which are working:
FAQ = CALCULATE( SUM('Adobe Analytics'[Page Views]), FILTER('Adobe Analytics',FIND("Faqs",'Adobe Analytics'[Page Journey],,0)<>0))
FAQ2 = IF(ISERROR(SEARCH("faqs",'Adobe Analytics'[Page Name])),[Page Views],0)The above measure returns 0 in all cases even when [Page Name] contains faqs
FAQ3 = if(CONTAINS('Adobe Analytics','Adobe Analytics'[Page Name],"faqs"),SUM('Adobe Analytics'[Page Views]),0)The above measure returns 0 in all cases even when [Page Name] contains faqs
Solved! Go to Solution.
Hi @Anonymous ,
One sample for your reference. We can create a measure as below.
Measure = CALCULATE ( SUM ( Table1[page view] ), FILTER ( Table1, SEARCH ( "faq", Table1[pagename], 1, BLANK () ) <> BLANK () ) )
Or we can create a calculated column as below.
faq = IF(ISBLANK(SEARCH("faq",Table1[pagename],1,BLANK())),BLANK(),Table1[page view])
Pbix as attached.
Hi @Anonymous ,
One sample for your reference. We can create a measure as below.
Measure = CALCULATE ( SUM ( Table1[page view] ), FILTER ( Table1, SEARCH ( "faq", Table1[pagename], 1, BLANK () ) <> BLANK () ) )
Or we can create a calculated column as below.
faq = IF(ISBLANK(SEARCH("faq",Table1[pagename],1,BLANK())),BLANK(),Table1[page view])
Pbix as attached.
@Anonymous add following measure
Total FAQ = CALCULATE( COUNTROWS( Yourtable ), CONTAINSSTRING( YourTable[YourColumn], "faq" ) )
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k but [Page Views] can contain a higher value than 1 so I need to return the value in that cell...
Also, I don't have the option of using CONTAINSSTRING, only CONTAINS and CONTAINSROW - both of which return #ERROR
@parry2k I've just played around with your formula and discovered that the below works - but only if you use the entire contents of [Page Name] - I need it to search for part of the string not an absolute value...
FAQ = IF(CONTAINS('Adobe Analytics','Adobe Analytics'[Page Name],"int:members:questions:faqs-pre-trip-planning"),[Page Views],0)
@Anonymous i think you don't have latest powerbi version and that's why containsstring is not working for you. upgrade your desktop and it should work.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k sadly I am contstrained by updates available in my company. I am using 2.64.5285.741 64-bit (November 2018).
Ah well I guess there isn't a solution for me on this occasion 😞
Thanks anyway
@Anonymousthere is always a solution, do me a favour, share sample data in excel from onedrive/google drive.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I managed to work out a solution in Query Editor rather than DAX using if Text.Contains()
I would rather have done it as a calculated column in DAX, than mess with my dataset, but it works so i'm happy!
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
115 | |
112 | |
105 | |
95 | |
58 |
User | Count |
---|---|
174 | |
147 | |
136 | |
102 | |
82 |