Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.