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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
JolienR
Helper II
Helper II

Count TRUE() / FALSE() resulting from a measure

Hi,

 

I am trying to count how many TRUE() and FALSE() are resulting from the measure DidUserPurchaseInBoth Periods. All the values in the matrix are measures, no columns.

I have created this measure: 

Verloop individueel =
COUNTAX(FILTER(MetingenKlanten;MetingenKlanten[DidUserPurchaseInBothPeriods]=TRUE());TRUE())
However, as you can see it is not working. 
 
Hopefully, someone can help.
JolienR_0-1661424233877.png

 

6 REPLIES 6
v-yanjiang-msft
Community Support
Community Support

Hi @JolienR ,

According to your snapshot, when you use the formula of @davehus 's, why not put the measure in a card visual like your original post? As according to the context, if you put the measure in the visual, it will return 1 on rows where the DidUserPurchaseInBoth Periods  is true. Or if you want to return the total number in each "true" row, modify the formula to :

Verloop individueel =
IF (
    'MetingenKlanten'[DidUserPurchaseInBothPeriods] = TRUE (),
    SUMX (
        FILTER (
            ALL ( MetingenKlanten ),
            MetingenKlanten[DidUserPurchaseInBothPeriods] = TRUE ()
        ),
        1
    )
)

I can't access your attached file, and it get correct result in my created sample.

vkalyjmsft_0-1661916416057.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

Hi @v-yanjiang-msft,

Many thanks for your reaction. Unfortunately, CustomerLast12-6Months & CustomerLast6-0Months are measures and I am not able to use the same measure for DidUsersPurchaseInBothPeriods as you did. Which results in the fact that Verloop invidueel still 1 is. 

Luuky
Helper I
Helper I

Hallo @JolienR,

If @davehus's suggestion doesn't work you can also try to change the last true for MetingenKlanten[DidUserPurchaseInBothPeriods]. That how I implemented the same statement in my model.

But I'm fairly certain the above suggestion would already work.

Vriendelijke groet,

Luuk

Hi @Luuky, & @davehus 

Unfortunately, it does not work. 
I uploaded a test file: https://drive.google.com/file/d/1xPceY0cWO3E6H-rBlE38gcA-ln35GNGD/view?usp=sharing

These measures are the I use: 

Calendar =
ADDCOLUMNS (
CALENDAR ("1-1-2010";"31-12-2060");
"Jaar"; YEAR ( [Date] );
"MaandNr"; MONTH([Date]);
"Maand"; FORMAT ( [Date]; "MMMM" );
"Weeknummer"; "week "& WeekNum([Date];21);
"Kwartaal"; "Q " & FORMAT ( [Date]; "Q" ))
 
CustomerLast12-6MonthsNew =
var maxDate = MAX('Calendar'[Date])
var StarDate = MINX(FILTER(DATESINPERIOD('Calendar'[Date]; maxDate; -6; MONTH ); 'Calendar'[Date]);'Calendar'[Date])
var result = CALCULATE(DISTINCTCOUNTNOBLANK('table'[ID_CUSTOMER_GUID]); DATESINPERIOD('Calendar'[Date]; StarDate; -6; MONTH ))
RETURN result


CustomerLast6-0MonthsNew =
var maxDate = MAX('Calendar'[Date])
var result = CALCULATE(DISTINCTCOUNT('table'[ID_CUSTOMER_GUID]); DATESINPERIOD('Calendar'[Date]; maxDate; -6; MONTH ))

return result
 
DidUserPurchaseInBothPeriods =
IF([CustomerLast12-6MonthsNew]&&[CustomerLast6-0MonthsNew];TRUE();FALSE())


Verloop individueel =
SUMX(FILTER(MetingenKlanten;MetingenKlanten[DidUserPurchaseInBothPeriods]=TRUE());MetingenKlanten[DidUserPurchaseInBothPeriods])

Hopefully you can help me!!
JolienR
Helper II
Helper II

Hi @davehus ,

Still the same result...

JolienR_0-1661425151362.png

 

davehus
Memorable Member
Memorable Member

Hi @JolienR ,

 

Try something like 

SUMX(FILTER('Table','Table'[ColumnName]=TRUE()),1)
 
Hope this helps.
 
D
 
Did I help you today? Please accept my solution and hit the Kudos button.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.