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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
qwerttty
Helper I
Helper I

Get help with true and false from the measure

Hi, 

I'm new in power bi and currently facing an issue with the previous measure. 

This is my raw data. 

TimestampTypeResult
16/08/2023 04:00A0
16/08/2023 04:30A0
17/08/2023 04:00A1
17/08/2023 04:30A0
18/08/2023 04:00A1
18/08/2023 04:30A1
16/08/2023 04:00B0
16/08/2023 04:30B0
17/08/2023 04:00B1
17/08/2023 04:30B0
18/08/2023 04:00B1
18/08/2023 04:30B1
16/08/2023 04:00C0
16/08/2023 04:30C0
17/08/2023 04:00C1
17/08/2023 04:30C0
18/08/2023 04:00C1
18/08/2023 04:30C1

 

For example, I would like to create a measure that count the final result. I group the column by date and type, max the results. 

I custom the result to true(0) and false (1). 

qwerttty_0-1694508603430.png

 

In my dashboard, i would like to create a matrix of the type and Custom. 

Rows will be type and values should be shown true and false for each type. 

Such as 16-18 August are week 33, when i filter the date to week 33, the result should be false for all types even though 16 are all true. 

 

But when filter to 16 August , the result should shown in true in the matrix. 

 

Other than that, I would like to create a measure that just shown the final result of 0 or 1 for true and false. The measure data here shown sum of the final result that is not i want.  

 

The measure that I used previously are shown below. This measure calculate when the value reach zero will count as true, but now i want to change it to must whole day is zero and true. 

Water Zero =

var T1=

ADDCOLUMNS('Water Incoming Zero Condition',"@Final", CALCULATE( NOT ISEMPTY('Water Incoming Zero Condition'),'Water Incoming Zero Condition'[Result]= 0))

var T2=

SELECTCOLUMNS(T1,"@@Final",[@Final])

Return

if(FALSE() in T2,FALSE(),TRUE())

 

Date for month = IF([Water Zero]=TRUE(),"0","1")

 

Kind regards. 

 

 

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi @qwerttty ,

I created a sample pbix file(see the attachment), please check if that is what you want.

Water Zero =
VAR _seldates =
    ALLSELECTED ( 'Water Incoming Zero Condition'[Timestamp] )
VAR _seltype =
    SELECTEDVALUE ( 'Water Incoming Zero Condition'[Type] )
VAR _maxdate =
    CALCULATE (
        MAX ( 'Water Incoming Zero Condition'[Timestamp] ),
        FILTER (
            ALLSELECTED ( 'Water Incoming Zero Condition' ),
            'Water Incoming Zero Condition'[Type] = _seltype
        )
    )
RETURN
    CALCULATE (
        MAX ( 'Water Incoming Zero Condition'[Custom] ),
        FILTER (
            ALLSELECTED ( 'Water Incoming Zero Condition' ),
            'Water Incoming Zero Condition'[Type] = _seltype
                && 'Water Incoming Zero Condition'[Timestamp] = _maxdate
        )
    )

vyiruanmsft_0-1694772066330.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yiruan-msft,

 

Thanks for the help again.

 

For the sum of the result, are there any way just shown the result at that there, not in total of the list of data? 

Example, 14 Sep should be 0 and 15 Sep should be 1.

qwerttty_3-1694779151075.png

Do you have a solution for this issue?

 

Kind regards. 

 

Hi @v-yiruan-msft,

 

Thanks for helping with the question. 

I have tried to used the measure that you created. It works for some situation, but some is not function. 

 

For example, in the situation of my data is shown in the image below. 

qwerttty_1-1694777530159.png

 

At the selection of date 14 september, only Ch6 shown true for me, however, the correct answer for this situation are ch2,and remaining should true also. 

qwerttty_2-1694778908166.png

 

Do you have a solution for this issue?

 

Kind regards. 

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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