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
jalaomar
Helper IV
Helper IV

Divide function not giving right value

Hi all,

 

in a tabel I have several measures displayed and in one of the measures i would like to calculate the margin% but it seems to give wrong value.

 

44/50=88%

any idea where i might be doing wrong? 

2021-09-29_19-14-55.png

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Probably a filter context issue...
What is the code for both measures and 
what does each measure in the DIVIDE function deliver in a card visual? 
Also what does the % measure deliver for the total row if added to the table visual?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

8 REPLIES 8
v-yalanwu-msft
Community Support
Community Support

Hi, @jalaomar ;

I tested a simple data, if your table's filter is different from your card visual , so it may be cause the different result.such as:

1.when the table's filter is enddate is not 2021-2-1,the result is 4/5=0.8

vyalanwumsft_0-1633341115065.png

2.if the table not have filter .it show 0.67

vyalanwumsft_1-1633341167961.png

3.So keep the filter criteria consistent in every visual.

vyalanwumsft_2-1633341347799.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

So true!!

PaulDBrown
Community Champion
Community Champion

Probably a filter context issue...
What is the code for both measures and 
what does each measure in the DIVIDE function deliver in a card visual? 
Also what does the % measure deliver for the total row if added to the table visual?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi,

I need to calculate how many projects that have fulfilled a certain criteria, all else is working well.

These are my measures 

VSU Days = DATEDIFF('KPI'[MIS3.1Actual 2];'KPI'[ITG4Actual2];DAY)

 

VSU 5 weeks = IF('KPI'[VSU Days] <=35; "1";"0")

 

PVoT Days = DATEDIFF('KPI'[ITG4Baseline2];'KPI'[ITG4Actual2];DAY)

 

ITG4 fullfillmentX = SWITCH(TRUE();

ISBLANK('KPI'[PVoT Days]);0;
'KPI'[PVoT Days]>=1;0;
'KPI'[PVoT Days]<=0;1;
0)
 

Count total = CALCULATE(COUNTROWS('KPI'))

 

Count of VSU fullfillment = CALCULATE(COUNTROWS('KPI'); FILTER('KPI';'KPI'[VSU 5 weeks]="1"))
 
calculate margin% = CALCULATE(DIVIDE('KPI'[Count of VSU fullfillment];'KPI'[Count total]))
amitchandak
Super User
Super User

@jalaomar ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Try like

Divide([Count of VSU fullfilment]*1.0, [Count Total])

Hi, These are my measures 

VSU Days = DATEDIFF('KPI'[MIS3.1Actual 2];'KPI'[ITG4Actual2];DAY)

 

VSU 5 weeks = IF('KPI'[VSU Days] <=35; "1";"0")

 

PVoT Days = DATEDIFF('KPI'[ITG4Baseline2];'KPI'[ITG4Actual2];DAY)

 

ITG4 fullfillmentX = SWITCH(TRUE();

ISBLANK('KPI'[PVoT Days]);0;
'KPI'[PVoT Days]>=1;0;
'KPI'[PVoT Days]<=0;1;
0)
 

Count total = CALCULATE(COUNTROWS('KPI'))

 

Count of VSU fullfillment = CALCULATE(COUNTROWS('KPI'); FILTER('KPI';'KPI'[VSU 5 weeks]="1"))
 
calculate margin% = CALCULATE(DIVIDE('KPI'[Count of VSU fullfillment];'KPI'[Count total]))
 
Was not able to provide sample data 
 
i tried your measure and it gave me an error as shown in the screenshot2021-09-29_20-10-06.png 

Change the [Count of SVU fulfillment] to

Count of VSU fullfillment = CALCULATE(COUNTROWS('KPI'); FILTER('KPI'; [VSU 5 weeks]=1))

 

Also, please provide the answers to the following:

what does each measure in the DIVIDE function deliver in a card visual? 
Also what does the % measure deliver for the total row if added to the table visual?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi,

 

What should I change in the measure?

Count of VSU fullfillment = CALCULATE(COUNTROWS('KPI'); FILTER('KPI'; [VSU 5 weeks]="1"))

 

what does each measure in the DIVIDE function deliver in a card visual? 

Count of VSU fullfillment measure is calculating the total number of rows that has the value 1 (1 is a string) 

Count Total is a measure calculating the total number of rows in the table 

Calculate margin% is calculating the % of projects that have the value 1 

 

Value 1 is indicating that the project has managed to deliver a machine within 35 days (diff between 2 actual dates)

Also what does the % measure deliver for the total row if added to the table visual?

Count Total & Count of VSU fullfillment I will not visualize in the table, just wanted to verify that the measure is working properly 

but Magin% i need to visualize as it is the KPI value to indicate the % of projects that has reached target.

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.