The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Solved! Go to Solution.
Hi @pbi1908 ,
This is a question about the filter context in this case you want to have all your calculations and the add the agent_bruno filter so you can add it has a filter on your visualization or using your metric you can do it based on the filter of the table:
VAR TABLE_TO_EXPORTED =
SUMMARIZECOLUMNS (
FILTER ( FT_SALES_BI, FT_SALES_BI[AGENT_BRUNO] = 1 ),
FT_BALANCE_BI[CUSTOMER_NAME_],
FT_BALANCE_BI[CURR],
"MAX_CREDIT_LIMIT",
MAXX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[CUSTOMER_NAME_] = SELECTEDVALUE ( FT_BALANCE_BI[CUSTOMER_NAME_] )
),
FT_BALANCE_BI[CREDIT_LIMITS]
),
"TOTAL BALANCE",
IF (
ISBLANK (
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
),
FT_BALANCE_BI[BALANCE]
)
),
0,
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
),
FT_BALANCE_BI[BALANCE]
)
),
"EXPECTED DUE BALANCE",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[OVERDUE_FLAG] = "DUE AMOUNT"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[TTYPE] = "1"
),
FT_BALANCE_BI[BALANCE] + 0
),
"DUE BALANCE",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[OVERDUE_FLAG] = "OVERDUE AMOUNT"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[TTYPE] = "1"
),
FT_BALANCE_BI[BALANCE] + 0
),
"0<DUE<15",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[OVERDUE_FLAG] = "OVERDUE AMOUNT"
),
FT_BALANCE_BI[15_DUE_DEFAULT_CURR] + 0
),
"15<DUE<30",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[OVERDUE_FLAG] = "OVERDUE AMOUNT"
),
FT_BALANCE_BI[15_DUE_30_DEFAULT_CURR] + 0
),
"30<DUE<60",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[OVERDUE_FLAG] = "OVERDUE AMOUNT"
),
FT_BALANCE_BI[30_DUE_60_DEFAULT_CURR] + 0
),
"60<DUE<120",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[OVERDUE_FLAG] = "OVERDUE AMOUNT"
),
FT_BALANCE_BI[60_DUE_120_DEFAULT_CURR] + 0
),
"120>DUE",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[OVERDUE_FLAG] = "OVERDUE AMOUNT"
),
FT_BALANCE_BI[DUE_120_DEFAULT_CURR] + 0
),
"OPEN NOT SHIPPED (WITH TOLLERANCE 5%)",
SUMX (
FILTER (
FT_SALES_BI,
FT_SALES_BI[CUSTOMER_NAME] = SELECTEDVALUE ( FT_BALANCE_BI[CUSTOMER_NAME_] )
),
FT_SALES_BI[OPEN_NOT_SHIPPED] + 0
),
"PLANNED NOT INVOICED",
ROUND (
SUMX (
FILTER (
FT_SALES_BI,
FT_SALES_BI[CUSTOMER_NAME] = SELECTEDVALUE ( FT_BALANCE_BI[CUSTOMER_NAME_] )
),
FT_SALES_BI[PLANNED_NOT_INVOICED]
)
+ SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 0
),
FT_BALANCE_BI[BALANCE] + 0
),
2
)
)
RETURN
TABLE_TO_EXPORTED
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @pbi1908 ,
This is a question about the filter context in this case you want to have all your calculations and the add the agent_bruno filter so you can add it has a filter on your visualization or using your metric you can do it based on the filter of the table:
VAR TABLE_TO_EXPORTED =
SUMMARIZECOLUMNS (
FILTER ( FT_SALES_BI, FT_SALES_BI[AGENT_BRUNO] = 1 ),
FT_BALANCE_BI[CUSTOMER_NAME_],
FT_BALANCE_BI[CURR],
"MAX_CREDIT_LIMIT",
MAXX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[CUSTOMER_NAME_] = SELECTEDVALUE ( FT_BALANCE_BI[CUSTOMER_NAME_] )
),
FT_BALANCE_BI[CREDIT_LIMITS]
),
"TOTAL BALANCE",
IF (
ISBLANK (
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
),
FT_BALANCE_BI[BALANCE]
)
),
0,
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
),
FT_BALANCE_BI[BALANCE]
)
),
"EXPECTED DUE BALANCE",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[OVERDUE_FLAG] = "DUE AMOUNT"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[TTYPE] = "1"
),
FT_BALANCE_BI[BALANCE] + 0
),
"DUE BALANCE",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[OVERDUE_FLAG] = "OVERDUE AMOUNT"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[TTYPE] = "1"
),
FT_BALANCE_BI[BALANCE] + 0
),
"0<DUE<15",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[OVERDUE_FLAG] = "OVERDUE AMOUNT"
),
FT_BALANCE_BI[15_DUE_DEFAULT_CURR] + 0
),
"15<DUE<30",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[OVERDUE_FLAG] = "OVERDUE AMOUNT"
),
FT_BALANCE_BI[15_DUE_30_DEFAULT_CURR] + 0
),
"30<DUE<60",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[OVERDUE_FLAG] = "OVERDUE AMOUNT"
),
FT_BALANCE_BI[30_DUE_60_DEFAULT_CURR] + 0
),
"60<DUE<120",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[OVERDUE_FLAG] = "OVERDUE AMOUNT"
),
FT_BALANCE_BI[60_DUE_120_DEFAULT_CURR] + 0
),
"120>DUE",
SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 1
&& FT_BALANCE_BI[OVERDUE_FLAG] = "OVERDUE AMOUNT"
),
FT_BALANCE_BI[DUE_120_DEFAULT_CURR] + 0
),
"OPEN NOT SHIPPED (WITH TOLLERANCE 5%)",
SUMX (
FILTER (
FT_SALES_BI,
FT_SALES_BI[CUSTOMER_NAME] = SELECTEDVALUE ( FT_BALANCE_BI[CUSTOMER_NAME_] )
),
FT_SALES_BI[OPEN_NOT_SHIPPED] + 0
),
"PLANNED NOT INVOICED",
ROUND (
SUMX (
FILTER (
FT_SALES_BI,
FT_SALES_BI[CUSTOMER_NAME] = SELECTEDVALUE ( FT_BALANCE_BI[CUSTOMER_NAME_] )
),
FT_SALES_BI[PLANNED_NOT_INVOICED]
)
+ SUMX (
FILTER (
FT_BALANCE_BI,
FT_BALANCE_BI[TTYPE] = "1"
&& FT_BALANCE_BI[ERP_VOUCHER_FLAG] = 0
),
FT_BALANCE_BI[BALANCE] + 0
),
2
)
)
RETURN
TABLE_TO_EXPORTED
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsJoin the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
116 | |
82 | |
75 | |
53 | |
44 |
User | Count |
---|---|
136 | |
128 | |
78 | |
64 | |
63 |