问题
I have the following SSAS Tabular model defined:
On the Product table, I have the following measures defined:
DeliveryQty2018:= CALCULATE ( SUM ( PurchaseDelivery[PurchaseOrderQuantity] ), ( PurchaseEstimatedWarehouseArrivalDate[PurchaseEstimatedWarehouseArrivalYear] = 2018 ) )
DeliveryQty2019:= CALCULATE ( SUM ( PurchaseDelivery[PurchaseOrderQuantity] ), ( PurchaseEstimatedWarehouseArrivalDate[PurchaseEstimatedWarehouseArrivalYear] = 2019 ) )
Sum DeliveryQty 2018-2020: = FORMAT([DeliveryQty2018] + [DeliveryQty2019] + [DeliveryQty2020],"# ### ###")
I'm creating a table visual on my Power BI report, that consists of the following fields:
This combinations gives me a cartesian product of: Product X ProductCategory:
What's interesting, when I remove the FORMAT() wrapper for the Sum DeliveryQty 18-20, cartesian product is removed and I achieve the single record I was loooking for. However, if I remove the ProductCategory field and leave the Sum DeliveryQty 18-20 measure with the FORMAT() function in place I also get the single record..
Can anyone explain to me what's going here in both scenarios?
回答1:
FORMAT turns blanks (nulls) into empty strings ""
rather than proper blanks, so you probably want to check for that first before formatting.
Sum DeliveryQty 2018-2020: =
VAR Qty = [DeliveryQty2018] + [DeliveryQty2019] + [DeliveryQty2020]
RETURN
IF ( ISBLANK ( Qty ), BLANK(), FORMAT ( Qty, "# ### ###" ) )
来源:https://stackoverflow.com/questions/65008244/dax-format-function-cause-cartesian-product-on-power-bi-visual