Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi
I make column that evalute if row has a date less than other row according this conditional:
I don't know why return a 0 when clarly the date of FIV is less the date of NFUR.
My code
VAR CurrentNHC = CCEE[NHC] // --> valor de la columna "NHC"
VAR FIV_Date = // --> valor data de la "FIV"
CALCULATE( // --> Fes un càlcul
VALUES(CCEE[Data Reporting]), // --> Agafa els valors de la columna "Data reporting"
CCEE[Tipus de planificació] = "FIV", // --> Filtrar pel valor "FIV" a la columna "Tipus de planificació"
CCEE[Count_FIV_per_NHC]=1, // --> Filtrat pel valor 1 a la columna "Count_FIV_per_NHC"
CCEE[NHC] = CurrentNHC // --> El valor NHC és igual al valor de la variable "CurrentNHC"
)
VAR NFUR_Date = // --> valor data de la "FIV"
CALCULATE( // --> Fes un càlcul
VALUES(CCEE[Data Reporting]), // --> Agafa els valors de la columna "Data reporting"
CCEE[Tipus de planificació] = "NFUR", // --> Filtrar pel valor "NFUR" a la columna "Tipus de planificació"
CCEE[Count_NFUR_per_NHC]=1, // --> Filtrat pel valor 1 a la columna "Count_NFUR_per_NHC"
CCEE[NHC] = CurrentNHC // --> El valor NHC és igual al valor de la variable "CurrentNHC"
)
RETURN IF(CCEE[Tipus de planificació] = "FIV" && CCEE[Count_FIV_per_NHC] = 1, IF(FIV_Date <= NFUR_Date, 1, 0))
Solved! Go to Solution.
Hi @RubenMerino ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) We can create a calculated column.
Column =
var _a=CALCULATE(MAX('Table'[Data Reporting]),FILTER('Table','Table'[NHC]=EARLIER('Table'[NHC]) && 'Table'[Count_FIV_per_NHC]=1 && 'Table'[Tipus de planificació]="FIV"))
var _b=CALCULATE(MAX('Table'[Data Reporting]),FILTER('Table','Table'[NHC]=EARLIER('Table'[NHC]) && 'Table'[Count_NFUR_per_NHC]=1 && 'Table'[Tipus de planificació]="NFUR"))
return IF('Table'[Count_FIV_per_NHC]=1 && 'Table'[Tipus de planificació]="FIV",IF(_a<=_b,1,0))
(3) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @RubenMerino ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) We can create a calculated column.
Column =
var _a=CALCULATE(MAX('Table'[Data Reporting]),FILTER('Table','Table'[NHC]=EARLIER('Table'[NHC]) && 'Table'[Count_FIV_per_NHC]=1 && 'Table'[Tipus de planificació]="FIV"))
var _b=CALCULATE(MAX('Table'[Data Reporting]),FILTER('Table','Table'[NHC]=EARLIER('Table'[NHC]) && 'Table'[Count_NFUR_per_NHC]=1 && 'Table'[Tipus de planificació]="NFUR"))
return IF('Table'[Count_FIV_per_NHC]=1 && 'Table'[Tipus de planificació]="FIV",IF(_a<=_b,1,0))
(3) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You can use the following measure
Maxx(filter(Table, [NHC] = earlier([NHC]) && [Tipus de planificació] = "FIV"),[Date Reporting] ) - [Date Reporting]
Hi Nirali
First, thank for your help.
But infortunally, looks like dosn't work
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
73 | |
57 | |
36 | |
31 |
User | Count |
---|---|
90 | |
60 | |
60 | |
49 | |
45 |