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.
Hi, I'm trying to calculate a percentage index of goal/accomplished.
But the divide function is causing defect in matrix display when using 2 numerators in the divide function.
For a reason I don't know, when use 2 numerators in divide formula, the page filter "year" doesn't works. The matrix show me all dates avaiable in my date dimension table.
The formula is:
DIVIDE (number1 - constant, number2 - constant)
Where the constant is represented by the measure [LINHA BASE MARG] with value 0.25
See:
When I use only one numerator, it works as expected (except by the fact that I have the wrong result because is lacking one value in numerator divide formula):
Any solution?
Solved! Go to Solution.
Hi @Anonymous ,
I see.
If you return ICM,you will find that the measure without constant value still showing result only for 2021:
But the measure with constant value are showing values with all the years:
It means that the if condition doesn work in your measure,so try to modify your measure as below:
ICM MARG =
VAR _ARG1 = [% MARGEM SM] - [LINHA BASE MARG]
VAR ARG2 = [META MARG] - [LINHA BASE MARG]
VAR ICM = DIVIDE(_ARG1, ARG2) //verificar porque quando o numerador do divide tem um número sendo subtraído a matriz perde o filtro do ano
VAR RESUL = IF(ICM < 0, BLANK(), ICM)
RETURN RESUL
And you will see:
The result only contains the value in 2021.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Hi @Anonymous
add VAR for each equation then use them in Divide:
var _1 = A-B
var _2 = C-D
var _Divide = DIVIDE( _1 ,_ 2 , 0)
RETURN
_Divide
or use _Result = (A-B) / (C-D)
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
The issue persist:
Can you verify and RETURN
ARG1
ARG2
and show the result please?
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
Arg1 and Arg2 below:
There isn't problem with the arg values.
I've found if I set the year filter in visual, it works. But I already have a year filter defined in the page filters.
From your visual I can see ARG1 < 0 and ARG2 > 0 when you divide them the result ICM is always < 0 .
In your IF statment
you wanted to RETURN 0 if ICM < 0. That<s why you see 0 in your visual.
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
The zero is not the problem, show zero to years 2016, 2017, 2018, etc when I have a filter defined to 2021 is the problem. I don't wanna see values to other years.
Here a similar discussing: https://community.powerbi.com/t5/Desktop/Slicer-not-filtering-measure-with-constant-value-over-date-...
Then you need to use SELECTEDVALUE for all your measures involved in DIVIDE.
May be if you can share your file I can help you better.
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
Here are the mistakes:
1- in your Matrix you are using fields that have inactive relationship with each others like using DATA FISCAL with SUPERMETA 2021
2- The inactive relationship between Tables are Many to Many (Wrong)
3- You see 0% for all years but 2021, because in your tabel "SUPERMETA 2021" you don't have data from the other years
4- most of the measures if not all where you are using USERELATIONSHIP are not correct since the relationship is Many to Many
5- The model (Tables and relationships) is not good. There is no star schema in place, Data fiscal....
6- In your model i see your using 3 Tables for your visuals, why uploading the rest of the Tables if you are not going to use them!
I recommend making some order in your file before going any further...
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
@aj1973 the page "SUPERMETA FAT 2021" works with same tables and works like a charm. There isn't problem with the relationship between the data.
The issue only occurs when a CONSTANT (fixed number) is added to the numerator of divide of my measure in page "SUPERMETA MARG 2021".
Like I said in description, when it doesn't have the constant in formula, everything goes well, but I need that constant, so I cant left the formula without it.
Hi @Anonymous ,
After checking your sample data,while using the 2 formula below:
ICM MARG1 =
var ARG1=[% MARGEM SM]
VAR ARG2 = [META MARG] - [LINHA BASE MARG]
VAR ICM = DIVIDE(ARG1, ARG2) //verificar porque quando o numerador do divide tem um número sendo subtraído a matriz perde o filtro do ano
VAR RESUL = IF(ICM < 0, 0, ICM)
RETURN RESUL
ICM MARG =
VAR _ARG1 = [% MARGEM SM] - [LINHA BASE MARG]
VAR ARG2 = [META MARG] - [LINHA BASE MARG]
VAR ICM = DIVIDE(_ARG1, ARG2) //verificar porque quando o numerador do divide tem um número sendo subtraído a matriz perde o filtro do ano
VAR RESUL = IF(ICM < 0, 0, ICM)
RETURN RESUL
When you move the slicer of matrix to the same year.They both have data:
So where is the problem?
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Hi @v-kelly-msft . I have a page filter defined to 2021 and the matrix show values to years 2016, 2017, 2018, etc, when I put a constant ( [LINHA BASE MARG] = 0.25 ) in numerator of divide. I don't wanna see values to other years.
I can't understand why the page filter doesn't works when I have a constant in numerator of divide. 🤷♂️
If the constant doesn't be there in numerator of divide, the page filter works decently.
Hi @Anonymous ,
I see.
If you return ICM,you will find that the measure without constant value still showing result only for 2021:
But the measure with constant value are showing values with all the years:
It means that the if condition doesn work in your measure,so try to modify your measure as below:
ICM MARG =
VAR _ARG1 = [% MARGEM SM] - [LINHA BASE MARG]
VAR ARG2 = [META MARG] - [LINHA BASE MARG]
VAR ICM = DIVIDE(_ARG1, ARG2) //verificar porque quando o numerador do divide tem um número sendo subtraído a matriz perde o filtro do ano
VAR RESUL = IF(ICM < 0, BLANK(), ICM)
RETURN RESUL
And you will see:
The result only contains the value in 2021.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Awesome! Thank you!
My freind this is your Matrix without Values
Please don't tell me that there is nothing wrong.
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
NEWS:
my measure use a constant value, then it is going to show for all dates regardless how I filter it because the measure is always returning a value. But, how to solve this?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
98 | |
75 | |
63 | |
62 |
User | Count |
---|---|
139 | |
104 | |
104 | |
80 | |
66 |