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
Anonymous
Not applicable

Count if values

Hello to all,

I ask for your help concerning a measurement of type "IF".

I would like to display "1000" when the value of the measurement "Digester level (m)" reaches the value of 6 then continue to display "1000" as long as the value of the measurement has not reached a value lower than 4. When the value is below 4, stop counting until the cycle repeats itself. Today here is my measurement:

Période torchée =
VAR _selDate = SELECTEDVALUE(dim_date[DT (1min)])
VAR _maxDate = CALCULATE(LASTNONBLANK(dim_date[DT (1min)], [booléen niveau digesteur]), FILTER(ALLSELECTED(dim_date[DT (1min)]), dim_date[DT (1min)] < _selDate))
VAR _maxDate_dig = CALCULATE(LASTNONBLANK(dim_date[DT (1min)], [Niveau Digesteur(m)]), FILTER(ALLSELECTED(fact_point_torch_juin), [Niveau Digesteur(m)] >= 4))
RETURN
IF(AND(CALCULATE([booléen niveau digesteur]=1000,FILTER(ALLSELECTED(dim_date),dim_date[DT (1min)] = _maxDate)),[Niveau Digesteur(m)]>=4),1000,0)
 
I obtain this result, the problem is that the "IF" does not wait that the measurement reaches again the value 6 to post 1000.
image.png
 
The cycle does not work, it would be necessary that the zone framed in red is equal to zero here.
image.png
 

Is my problem clear ?

Thank you in advance,

Have a nice day

Joël

1 REPLY 1
lbendlin
Super User
Super User

@Anonymous The problem is clear, and it is a nice one.  Powert BI is really bad at hysteresis  (it has no memory) but I think with a bit of DAX trickery this can be achieved, with LASTNONBLANKVALUE or similar.

 

Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. 

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.

Top Solution Authors