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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

how to calculate value count and filter by other 3 columns in visualization?

Hi team , 

1. I have some data in a csv file.

2. I want to

       a) calculate the value count for dataSource column, ratingTypeColumn, and userElement column,

       b) visualize them in 3 bar charts seperately in Report tab.

       c) (important)filter these 3 bar charts by dataCenter,customer and companyID in Report tab.

   Expected output should be (I am not sure if my expected output format is reasonable because i want the capability to filter the data by dataCetner, customer and companyID as well.)

   

3. How tho achieve this requirment by DAX script?

 

Thanks,

Cherie

 

1 ACCEPTED SOLUTION

@Anonymous 

 

You can split those data and create a clear table with Power Query:

let
    Source = Table,
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "dataSource", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"dataSource.1", "dataSource.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"dataSource.1", type text}, {"dataSource.2", type text}}),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type", "ratingType", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"ratingType.1", "ratingType.2", "ratingType.3"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"ratingType.1", type text}, {"ratingType.2", type text}, {"ratingType.3", type text}}),
    #"Split Column by Delimiter2" = Table.SplitColumn(#"Changed Type1", "userElement", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"userElement.1", "userElement.2", "userElement.3", "userElement.4"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter2",{{"userElement.1", type text}, {"userElement.2", type text}, {"userElement.3", type text}, {"userElement.4", type text}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type2", {"dataCenter", "Customer", "companyID"}, "Attribute", "Value"),
    #"Split Column by Delimiter3" = Table.SplitColumn(#"Unpivoted Columns", "Attribute", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Attribute.1", "Attribute.2"}),
    #"Changed Type3" = Table.TransformColumnTypes(#"Split Column by Delimiter3",{{"Attribute.1", type text}, {"Attribute.2", Int64.Type}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type3",{"Attribute.2"})
in
    #"Removed Columns"

 

use this code and update your table.

 

the result:

VahidDM_0-1641786447576.png

 

 

Or use this code to create another table, then relate that to the old table and use them to create the result outputs.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

 

View solution in original post

4 REPLIES 4
VahidDM
Super User
Super User

Hi @Anonymous 

 

Can you post sample data as text (table) and expected output?

please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
4. Relation between your tables

Appreciate your Kudos!!
LinkedIn:www.linkedin.com/in/vahid-dm/

Anonymous
Not applicable

i post sample data and expected output in table format now.

@Anonymous 

 

You can split those data and create a clear table with Power Query:

let
    Source = Table,
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "dataSource", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"dataSource.1", "dataSource.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"dataSource.1", type text}, {"dataSource.2", type text}}),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type", "ratingType", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"ratingType.1", "ratingType.2", "ratingType.3"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"ratingType.1", type text}, {"ratingType.2", type text}, {"ratingType.3", type text}}),
    #"Split Column by Delimiter2" = Table.SplitColumn(#"Changed Type1", "userElement", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"userElement.1", "userElement.2", "userElement.3", "userElement.4"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter2",{{"userElement.1", type text}, {"userElement.2", type text}, {"userElement.3", type text}, {"userElement.4", type text}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type2", {"dataCenter", "Customer", "companyID"}, "Attribute", "Value"),
    #"Split Column by Delimiter3" = Table.SplitColumn(#"Unpivoted Columns", "Attribute", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Attribute.1", "Attribute.2"}),
    #"Changed Type3" = Table.TransformColumnTypes(#"Split Column by Delimiter3",{{"Attribute.1", type text}, {"Attribute.2", Int64.Type}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type3",{"Attribute.2"})
in
    #"Removed Columns"

 

use this code and update your table.

 

the result:

VahidDM_0-1641786447576.png

 

 

Or use this code to create another table, then relate that to the old table and use them to create the result outputs.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

 

Anonymous
Not applicable

@VahidDM  Is this achievable by DAX?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.