The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Can someone explain how the allexcept used as table expression in summarize work here. Is there any alternative to produce the required meaure
Solved! Go to Solution.
The ALLEXCEPT function in DAX is used to remove all filters from a table except for the specified columns. In the provided code, ALLEXCEPT is used within the SUMMARIZE function to create a summary table that includes all rows from the Winesales table, but only keeps the filter on the WINE column. This allows the calculation of the average yearly sales for each wine across all years.
Yearly Average Each Wine =
VAR Summarytable =
SUMMARIZE (ALLEXCEPT (Winesales, Wines [WINE]), DateTable [YEAR] )
RETURN
AVERAGEX (Summarytable, [Total Sales])
Proud to be a Super User! |
|
If you have a Product table with five columns (ProductKey, ProductName, Brand, Flavor, Category), the following syntaxes produce the same result:
ALL ( Product[ProductName], Product[Brand], Product[Flavor] )
ALLEXCEPT ( Product, Product[ProductKey], Product[Category] )
My understanding base on your picture is, that our goal is to get result for average amount of wines sold and the average should be counted per year. I tried to use that approach with my data, where I use chocolate products instead of wines. I created one measure according your photo and another measure using ALL instead of the ALLEXCEPT. Then I controlled the results base on orders in Sales table.
If you have a Product table with five columns (ProductKey, ProductName, Brand, Flavor, Category), the following syntaxes produce the same result:
ALL ( Product[ProductName], Product[Brand], Product[Flavor] )
ALLEXCEPT ( Product, Product[ProductKey], Product[Category] )
My understanding base on your picture is, that our goal is to get result for average amount of wines sold and the average should be counted per year. I tried to use that approach with my data, where I use chocolate products instead of wines. I created one measure according your photo and another measure using ALL instead of the ALLEXCEPT. Then I controlled the results base on orders in Sales table.
The ALLEXCEPT function in DAX is used to remove all filters from a table except for the specified columns. In the provided code, ALLEXCEPT is used within the SUMMARIZE function to create a summary table that includes all rows from the Winesales table, but only keeps the filter on the WINE column. This allows the calculation of the average yearly sales for each wine across all years.
Yearly Average Each Wine =
VAR Summarytable =
SUMMARIZE (ALLEXCEPT (Winesales, Wines [WINE]), DateTable [YEAR] )
RETURN
AVERAGEX (Summarytable, [Total Sales])
Proud to be a Super User! |
|
Is there any alterantive. Like using Values
User | Count |
---|---|
16 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |