Professional Documents
Culture Documents
Advance Power Bi Question Set-1
Advance Power Bi Question Set-1
best_selling_artist =
SELECTCOLUMNS (
SUMMARIZE (
'invoice_line',
'Artist'[artist_id],
'artist'[name],
"total_sales", SUMX('invoice_line', invoice_line[unit_price] *
invoice_line[quantity])
),
"artist_id", [artist_id],
"artist_name", [name],
"total_sales", [total_sales]
)
table by artist, calculating the total sales for each artist. It retrieves
the artist's ID and name from the 'Artist' table.
● The SELECT COLUMNS function is then used to select specific
first_name, last_name), the best selling artist's name, and the total
amount spent.
RETURN
SELECTCOLUMNS (
BestSellingArtist,
"customer_id",customer[customer_id],
"first_name",[first_name],
"last_name",[last_name],
"artist_name", 'best_selling_artist'[artist_name],
"amount_spent", [amount_spent]
)
● This is the return statement of the calculation.
● It uses the SELECT COLUMNS function to select columns from the
BestSellingArtist variable.
● The selected columns are renamed as "customer_id", "first_name",
"last_name", "artist_name", and "amount_spent".
OUTPUT: