cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

"Summary" Report of Columns Data

Hi - I have a data set with these columns:

Untitled2.png

 

I need to create a summary report like this, with the yellow columns being calculated from the columns in the data set. I have figured out how to use a measure to calculate the total data number and %>limit, but it only seems to work with the columns specificed (i.e. I would have to make 40+ measures to cover all of the contaminants). Is there a better way to accomplish this?

 

Untitled.png

 

Currently this is done in Excel using the "countif" function and then manually inputing the values into the report table. We need to be able to keep adding rows to the data set and would like to have the report updated without manually inputting changes. 

 

Best regards,

Jim

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: "Summary" Report of Columns Data

Yes. There is a better way.  In the query editor, make two tables from your one.

 

In the first - keep all the first rows that have the sample metadata (origin, date tested, etc.).  Make sure you keep SampleID as you will relate it to table 2.

 

In the second - remove the sample metadata rows and keep the SampleID column and all the results columns.  Select SampleID, right click and choose unpivot other columns.  You will get Attribute and Value columns (rename if you want).  Make measures that analyze the Value column (avg result, % over limit, etc.).  You can use the Attribute column as your rows or columns in a matrix visual.  You can also make a Groups column to group Heavy Metals, etc. tests together to give you that higher level hierarchy of results.

https://exceleratorbi.com.au/grouping-in-power-bi-desktop-without-using-dax/

 

You may need a 3rd table to hold your limit values for each test (don't see that in your example data).

 

Note: you can just unpivot the result columns in your existing query but then you are duplicating all the metadata values in every row.  The above approach to split into two tables is a better practice.

 

It is different that traditional Excel but it is the way to go.  I am an Analytical Chemist and do this all the time.  Feel free to post example data if additional help needed.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

View solution in original post

5 REPLIES 5
Highlighted
Community Champion
Community Champion

Re: "Summary" Report of Columns Data

Yes. There is a better way.  In the query editor, make two tables from your one.

 

In the first - keep all the first rows that have the sample metadata (origin, date tested, etc.).  Make sure you keep SampleID as you will relate it to table 2.

 

In the second - remove the sample metadata rows and keep the SampleID column and all the results columns.  Select SampleID, right click and choose unpivot other columns.  You will get Attribute and Value columns (rename if you want).  Make measures that analyze the Value column (avg result, % over limit, etc.).  You can use the Attribute column as your rows or columns in a matrix visual.  You can also make a Groups column to group Heavy Metals, etc. tests together to give you that higher level hierarchy of results.

https://exceleratorbi.com.au/grouping-in-power-bi-desktop-without-using-dax/

 

You may need a 3rd table to hold your limit values for each test (don't see that in your example data).

 

Note: you can just unpivot the result columns in your existing query but then you are duplicating all the metadata values in every row.  The above approach to split into two tables is a better practice.

 

It is different that traditional Excel but it is the way to go.  I am an Analytical Chemist and do this all the time.  Feel free to post example data if additional help needed.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

View solution in original post

Highlighted
Super User IV
Super User IV

Re: "Summary" Report of Columns Data

Hi,

Share data in a format that can be pasted in an MS Excel file.  Please show clearly how the numbers should be calculated for the 2 yellow columns.


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

Re: "Summary" Report of Columns Data

Hi @jtc017 ,

 

You may upload the excel files to SharePoint online since any changes in cloud data source will sync with report, then connect to the data using SharePoint folder connector in Power BI Desktop, use the URL below and use organizational account method.  See more: Connecting to Files in SharePoint & OneDrive with Power BI / Power Query. In this way, you may needn't to import data manually to get updated data.

 

>>I have figured out how to use a measure to calculate the total data number and %>limit, but it only seems to work with the columns specificed (i.e. I would have to make 40+ measures to cover all of the contaminants). 

 

For further analysis, you may clarify the logic about the yellow columns total data number and %>limit .

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

Highlighted
Frequent Visitor

Re: "Summary" Report of Columns Data

@mahoneypat 

Thanks!

 

I think your solution will work, but I am having trouble figuring out the approriate DAX for the measure to give % > limit while referencing the correct limits. As you suggested, I have a 3rd table that holds the limits, but I am not sure how to reference them in the measure.

 

Table 3

Untitled3.png

 

The current formula I have for the measure is:

% > limit = CALCULATE(CALCULATE(
COUNTA('Table2'[Value]),'Table2'[Value]>______)/counta('Table2'[Value])*100)
 
I am not sure how to reference the table of limits, I couldn't get valuelookup to work. The formula seems limited to entering a specific values, i.e.:
 
% > limit = CALCULATE(CALCULATE(
COUNTA('Table2'[Value]),'Table2'[Value]>"0.3"/counta('Table2'[Value])*100)
 
How would I reference the table of limits in this measure?
Highlighted
Frequent Visitor

Re: "Summary" Report of Columns Data

Nevermind! I finally realized my issues with the measures were because the data type was set as "Text" for the values column after unpivoting. Now that I have it set to Decimel number, the measures seem to be working.

 

Best regards,

Jim

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.

Top Solution Authors
Top Kudoed Authors