The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have created a measure of type %:
_€_INVERSION_N_% =
VAR _CurrentEjercicio = CONVERT( IF(MONTH(TODAY())<7, YEAR(TODAY())-1,YEAR(TODAY())),STRING)
VAR __BASELINE_VALUE
=CALCULATE(SUM(CV_SX_FI_CE11000[VENTA_BRUTA]),CV_SX_FI_CE11000[EJERCICIO]=_CurrentEjercicio)
VAR __VALUE_TO_COMPARE = CALCULATE(SUM(CV_SX_FI_CE11000[VENTA_BRUTA])-
SUM(CV_SX_FI_CE11000[DDF])),CV_SX_FI_CE11000[EJERCICIO]=_CurrentEjercicio)
RETURN
IF(
NOT ISBLANK(__BASELINE_VALUE) && __BASELINE_VALUE>0,
(__VALUE_TO_COMPARE/__BASELINE_VALUE),
IF(__VALUE_TO_COMPARE>0,1,0)
)
I want to create similar measure but ingnoring filters but it doesn't work, it shows same date:
_€_INVERSION_N_%_TOTALCOMPAÑIA =
VAR _CurrentEjercicio = CONVERT( IF(MONTH(TODAY())<7, YEAR(TODAY())-1,YEAR(TODAY())),STRING)
VAR __BASELINE_VALUE
=CALCULATE(SUM(CV_SX_FI_CE11000[VENTA_BRUTA]),CV_SX_FI_CE11000[EJERCICIO]=_CurrentEjercicio)
VAR __VALUE_TO_COMPARE = CALCULATE(SUM(CV_SX_FI_CE11000[VENTA_BRUTA])-
SUM(CV_SX_FI_CE11000[DDF])),CV_SX_FI_CE11000[EJERCICIO]=_CurrentEjercicio)
RETURN
CALCULATE( IF(
NOT ISBLANK(__BASELINE_VALUE) && __BASELINE_VALUE>0,
(__VALUE_TO_COMPARE/__BASELINE_VALUE),
IF(__VALUE_TO_COMPARE>0,1,0)
), ALL())
The purpose is to show a table with articles and the percentage of the article and the same percentage for all articles.
Solved! Go to Solution.
Hi @Anonymous ,
According to your description, maybe ALL() can be placed in the front, and I created a simple example to test, as follows
_€_INVERSION_N_%_TOTALCOMPAÑIA =
VAR _CurrentEjercicio =
CONVERT (
IF ( MONTH ( TODAY () ) < 7, YEAR ( TODAY () ) - 1, YEAR ( TODAY () ) ),
STRING
)
VAR __BASELINE_VALUE =
CALCULATE (
SUM ( CV_SX_FI_CE11000[VENTA_BRUTA] ),
FILTER (
ALL ( CV_SX_FI_CE11000 ),
CV_SX_FI_CE11000[EJERCICIO] = _CurrentEjercicio
)
)
VAR __VALUE_TO_COMPARE =
CALCULATE (
SUM ( CV_SX_FI_CE11000[VENTA_BRUTA] ) - SUM ( CV_SX_FI_CE11000[DDF] ),
FILTER (
ALL ( CV_SX_FI_CE11000 ),
CV_SX_FI_CE11000[EJERCICIO] = _CurrentEjercicio
)
)
RETURN
IF (
NOT ISBLANK ( __BASELINE_VALUE )
&& __BASELINE_VALUE > 0,
( __VALUE_TO_COMPARE / __BASELINE_VALUE ),
IF ( __VALUE_TO_COMPARE > 0, 1, 0 )
)
The final output is shown below:
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.
Hi @Anonymous ,
According to your description, maybe ALL() can be placed in the front, and I created a simple example to test, as follows
_€_INVERSION_N_%_TOTALCOMPAÑIA =
VAR _CurrentEjercicio =
CONVERT (
IF ( MONTH ( TODAY () ) < 7, YEAR ( TODAY () ) - 1, YEAR ( TODAY () ) ),
STRING
)
VAR __BASELINE_VALUE =
CALCULATE (
SUM ( CV_SX_FI_CE11000[VENTA_BRUTA] ),
FILTER (
ALL ( CV_SX_FI_CE11000 ),
CV_SX_FI_CE11000[EJERCICIO] = _CurrentEjercicio
)
)
VAR __VALUE_TO_COMPARE =
CALCULATE (
SUM ( CV_SX_FI_CE11000[VENTA_BRUTA] ) - SUM ( CV_SX_FI_CE11000[DDF] ),
FILTER (
ALL ( CV_SX_FI_CE11000 ),
CV_SX_FI_CE11000[EJERCICIO] = _CurrentEjercicio
)
)
RETURN
IF (
NOT ISBLANK ( __BASELINE_VALUE )
&& __BASELINE_VALUE > 0,
( __VALUE_TO_COMPARE / __BASELINE_VALUE ),
IF ( __VALUE_TO_COMPARE > 0, 1, 0 )
)
The final output is shown below:
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.
Hi,
To simplify our measure you can already use DIVIDE instead of your IF and NOTISBLANK.
This will make it simpler to read.
DIVIDE function does the test and offers you an alternative result if the test failed :
A/B with test on B not blank and zero if B is null, becomes DIVIDE(A,B,0) the 0 stands for alternate result.
Then for your filter problems, maybe you can try, REMOVEFILTER function. But I'm not 100% sure of which type of ilters and on which columns you want to remove (comes from a slicer, from your table ?)
Hope this helps