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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors