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
jtc017
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
mahoneypat
Employee
Employee

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





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

5 REPLIES 5
v-xicai
Community Support
Community Support

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.

Ashish_Mathur
Super User
Super User

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/
mahoneypat
Employee
Employee

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





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@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?
jtc017
Frequent Visitor

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
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.