 Hey guys, welcome to SSU Retreat social this side and today we are going to see one more real-time interview question which was asked in PwC so recently one of my friend has attended interview in PwC so this question was asked there so before going forward we have already discussed few scenario-based question which was asked in PwC so you can go in the YouTube and you can search for PwC Power BI interview questions and answers and after that you can specify my channel name and you can search so you can see this question so we have already discussed about this so before going forward I would say you can also watch these videos so let me go and try to see for today's scenario so first interviewer has asked what is the summarized function inside the power BI and second he will be going to ask once we have answer about the summarized function so what is summarized function so summarized function is going to return a table and it is taking the input parameters the first parameter will be the table second parameter will be the group by columns so it will be going to return the summarized column with the group by so this is very straight forward the SQL statement where we will be going to write the select column 1, column 2, column 3, aggregate function with the column x and in the group by we are specifying the other columns except the aggregate columns so that is the inside the SQL server so similarly here we are specifying the table name first second is the group by columns so we can specify here the group by columns after that we can see the name so inside the name what will be the expression name that we can specify here and after that the expression like the sum aggregate functions we are going to use so that we can specify so on that example interviewer has specified this sales table so what is this sales table so this sales table is having data like sales order id sales order date customer id quantity value country and city and interviewer wants to see the total sale of the country and city wise so the output he want like the country then the city and after that what will be the sum of the value so that table he want to create by using this table so we can achieve it by using the summarized function so let me quickly go into another power bi and here let me quickly go inside the modeling tab and here we can see on the top side on the table tools the new table so let me click on this new table so it will be going to create a new table and that new table let me quickly call this table as summarize table now here we can use the summarize function so under the summarize function first parameter is the table so table which is the sales table so we can select the sales here now it is asking about the group by columns so the first group by column that is the country and second group by column that is the city so we can select these two and after that we need to specify the column name so we want to see the column name as total sales for the aggregated column and we want to do the aggregate like the sum of the sales value then we can close the bracket and after that we can close the bracket so this is the DAX formula we have to write to create the table and this table will be having the data for the country city and total sales according to the country and city so that we can see like the country city and whatever the total sale if you want to add another column here then we can also add so how we can add after this we can put comma and next we want to call this as total quantity so it will be adding another aggregated column and this will be the sum of the total quantity and we can close the bracket and put enter so now we will be having total four columns first will be total sales and second will be total quantity so this is we can achieve by using the summarize function second interviewer wants to filter this data that we have seen here only for the country india so how we can write the formula here to filter for the country india only so there is two ways to filter out let me quickly show the first way we can directly call the filter formula here it is asking the table so whatever we are returning from this summarize is a table so after this we can directly filter for the country of this table is equals to india we can close the bracket so it will be filtered and now we will see only for the india record but interviewer wants to understand what we have written here is the good for the performance or not so actually it's not because first we are summarizing whatever the data that we have here we have only the data for the three countries let's assume if we have the data for the 50 countries and we want to summarize the data only for a single country then this DAX is not the good option so how we can write the improvement on this DAX so that will be more efficient in the performance so interval wants to understand that one so that's why he has asked that question so before going to summarize here we are passing the table that is the sales table so we need to do the filter directly here instead of after summarizing so we can filter this table and put comma then we want to filter for the country india so it is like this and after that we can close the bracket for the filter and put in turn so now it will return the same output but as per the performance this is the efficient in the performance so interval wants to see this query from your side because it is filtering before the summarization thank you so much for watching this video see you in the next video with another question which was asked in pwc