Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
HagenHawke
Frequent Visitor

IS NUMBER AND SEARCH FUNCTIONS IN POWER BI

Hi Community,

I am very new to Power BI. I just completed my Power BI Beginners and Intermediate courses 3 weeks ago and taking on a small project within my team to convert one report from excel to Power BI. I am the first person in my wider team to use Power BI and really in need of some guidance.

 

I want to add an aditional function to my growth calculations to say that "If the (Table[Metric] contains "%" then just give me the value in 2H19"  and not to apply the 'growth calculation' as highlighted in 'blue' in the table  below.

 

I want layer it to the growth formula that I wrote below:

 

Growth =
var currperiod = sum(MasterData[Value])
Var relativeperiod = CALCULATE(SUM(MasterData[Value]),USERELATIONSHIP(dim_RelativePeriod[Period],MasterData[Period]),ALL(dim_Period))
return currperiod relativeperiod -1
 
 

Below is an example of my data:

 

CompanyMetric1H182H19Growth
ACash earnings1200220884.00%
ANet Interest Income5000622524.50%
ATotal Operating Expenses-2554-2518-1.41%
ANet Interest Margin %-2%-3%-3%
CCash earnings121269122.31%
CNet Interest Income32152061.99%
CTotal Operating Expenses-621-369-40.58%
CNet Interest Margin %-3%4%4%
ECash earnings12512968137.25%
ENet Interest Income72156213-13.89%
ETotal Operating Expenses-4215-45788.61%
ENet Interest Margin %-5%-6%-6%

 

Thank you so much in advance for your help.

 

Kind regards,

M

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @HagenHawke 

 

If your original table is like the following table (values in a column will be converted into the same format so the rate values with % will be converted into general decimal numbers),

vjingzhang_0-1655695592544.png

 

You can create a new column with below DAX code. 

Growth = IF(CONTAINSSTRING('MasterData'[Metric],"%"), 'MasterData'[2H19], DIVIDE('MasterData'[2H19] - 'MasterData'[1H18], 'MasterData'[1H18]))

vjingzhang_1-1655696091567.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @HagenHawke 

 

If your original table is like the following table (values in a column will be converted into the same format so the rate values with % will be converted into general decimal numbers),

vjingzhang_0-1655695592544.png

 

You can create a new column with below DAX code. 

Growth = IF(CONTAINSSTRING('MasterData'[Metric],"%"), 'MasterData'[2H19], DIVIDE('MasterData'[2H19] - 'MasterData'[1H18], 'MasterData'[1H18]))

vjingzhang_1-1655696091567.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors