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

Dax to count the true registration

Hi,

 

I want to have a count of the "true" records found in different columns by clients.

Example data below:

 

 

 

DAX Q.JPG

Thanks

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Please check the following steps as below.

 

1. Unpivot the table as below then close and apply.

Capture.PNG

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUXJz9Al2BdIhQaFwKlYnWikJTQymEiSXjKQPlQbJpuCVTcW0EyoZCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [name = _t, crm_car = _t, crm_com = _t, crm_atm = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"name", type text}, {"crm_car", type logical}, {"crm_com", type logical}, {"crm_atm", type logical}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"name"}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"

 

2. Create a matrix based on the measure.

Measure 2 = 
IF (
    ISINSCOPE ( 'Table'[Attribute] ),
    CONCATENATEX ( 'Table', 'Table'[Value] ),
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', 'Table'[Value] = TRUE () )
    ) + 0
)

 

2.PNG 

 

Pbix as attached.

 

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

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

That is the final visual you are showing us.  Share the actual data, describe the question and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Here is my data;

 

DAX1.JPG

 


DAX2.JPGWhat a want to get is te count of the true récords.:

Dax 3.JPG

 

 

 

Hi @Anonymous ,

 

Please check the following steps as below.

 

1. Unpivot the table as below then close and apply.

Capture.PNG

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUXJz9Al2BdIhQaFwKlYnWikJTQymEiSXjKQPlQbJpuCVTcW0EyoZCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [name = _t, crm_car = _t, crm_com = _t, crm_atm = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"name", type text}, {"crm_car", type logical}, {"crm_com", type logical}, {"crm_atm", type logical}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"name"}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"

 

2. Create a matrix based on the measure.

Measure 2 = 
IF (
    ISINSCOPE ( 'Table'[Attribute] ),
    CONCATENATEX ( 'Table', 'Table'[Value] ),
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', 'Table'[Value] = TRUE () )
    ) + 0
)

 

2.PNG 

 

Pbix as attached.

 

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

Hi,

What is the purpose of sharing the second image?  Share the link from where I can download your PBI file (with your build in visual).  Also, since in think I may need to carry out a transformation in the Query Editor, also share the base Excel file from where you would have imported data to PBI desktop.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.