{"id":95614,"date":"2026-04-18T22:23:20","date_gmt":"2026-04-18T15:23:20","guid":{"rendered":"https:\/\/itviec.com\/blog\/?p=95614"},"modified":"2026-04-18T22:24:40","modified_gmt":"2026-04-18T15:24:40","slug":"ham-calculate-trong-power-bi","status":"publish","type":"post","link":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/","title":{"rendered":"H\u00e0m CALCULATE trong Power BI:\u00a0H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng k\u00e8m v\u00ed d\u1ee5"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed9i dung b\u00e0i vi\u1ebft<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#Tong_quan_ve_ham_CALCULATE_trong_Power_BI\" >T\u1ed5ng quan v\u1ec1 h\u00e0m CALCULATE trong Power BI<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#Vi_sao_ham_CALCULATE_quan_trong\" >V\u00ec sao h\u00e0m CALCULATE quan tr\u1ecdng?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#Cau_truc_cu_phap_cua_CALCULATE\" >C\u1ea5u tr\u00fac c\u00fa ph\u00e1p c\u1ee7a CALCULATE<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#CALCULATE_thay_doi_filter_context_nhu_the_nao\" >CALCULATE thay \u0111\u1ed5i filter context nh\u01b0 th\u1ebf n\u00e0o?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#Vi_du_su_dung_ham_CALCULATE_trong_Power_BI\" >V\u00ed d\u1ee5 s\u1eed d\u1ee5ng h\u00e0m CALCULATE trong Power BI<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#Nhung_ham_thuong_dung_cung_ham_CALCULATE_trong_Power_BI\" >Nh\u1eefng h\u00e0m th\u01b0\u1eddng d\u00f9ng c\u00f9ng h\u00e0m CALCULATE trong Power BI<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#Loi_thuong_gap_khi_dung_CALCULATE\" >L\u1ed7i th\u01b0\u1eddng g\u1eb7p khi d\u00f9ng CALCULATE<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#Cac_cau_hoi_thuong_gap_ve_ham_CALCULATE_trong_Power_BI\" >C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 h\u00e0m CALCULATE trong Power BI<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#Ham_CALCULATE_co_gi_khac_voi_ham_SUMX\" >H\u00e0m CALCULATE c\u00f3 g\u00ec kh\u00e1c v\u1edbi h\u00e0m SUMX?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#Tong_ket\" >T\u1ed5ng k\u1ebft<\/a><\/li><\/ul><\/nav><\/div>\n\n<p><strong><em>Trong h\u1ec7 sinh th\u00e1i DAX c\u1ee7a Power BI, h\u00e0m CALCULATE trong Power BI cho ph\u00e9p b\u1ea1n ki\u1ec3m so\u00e1t v\u00e0 thay \u0111\u1ed5i ng\u1eef c\u1ea3nh l\u1ecdc tr\u01b0\u1edbc khi th\u1ef1c hi\u1ec7n ph\u00e9p t\u00ednh \u0111\u00f3, can thi\u1ec7p s\u00e2u h\u01a1n c\u00e1c h\u00e0m t\u1ed5ng h\u1ee3p nh\u01b0 SUM hay AVERAGE. Ch\u00ednh kh\u1ea3 n\u0103ng n\u00e0y bi\u1ebfn h\u00e0m CALCULATE th\u00e0nh n\u1ec1n t\u1ea3ng c\u1ee7a h\u1ea7u h\u1ebft c\u00e1c b\u00e0i to\u00e1n ph\u00e2n t\u00edch n\u00e2ng cao nh\u01b0 KPI \u0111\u1ed9ng, so s\u00e1nh theo th\u1eddi gian hay t\u00ednh to\u00e1n t\u1ef7 l\u1ec7 ph\u1ea7n tr\u0103m.<\/em><\/strong><\/p>\n\n\n\n<p>\u0110\u1ecdc b\u00e0i vi\u1ebft n\u00e0y \u0111\u1ec3 hi\u1ec3u r\u00f5 h\u01a1n v\u1ec1:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>CALCULATE trong Power BI l\u00e0 g\u00ec?<\/li>\n\n\n\n<li>C\u00e1ch CALCULATE thay \u0111\u1ed5i Filter Context<\/li>\n\n\n\n<li>V\u00ed d\u1ee5 s\u1eed d\u1ee5ng CALCULATE<\/li>\n\n\n\n<li>Nh\u1eefng h\u00e0m th\u01b0\u1eddng \u0111\u01b0\u1ee3c d\u00f9ng c\u00f9ng CALCULATE<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-t\u1ed5ng-quan-v\u1ec1-ham-calculate-trong-power-bi\"><span class=\"ez-toc-section\" id=\"Tong_quan_ve_ham_CALCULATE_trong_Power_BI\"><\/span><strong>T\u1ed5ng quan v\u1ec1 h\u00e0m CALCULATE trong Power BI<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>CALCULATE l\u00e0 m\u1ed9t trong nh\u1eefng h\u00e0m quan tr\u1ecdng v\u00e0 quy\u1ec1n l\u1ef1c nh\u1ea5t trong DAX c\u1ee7a Power BI.<\/p>\n\n\n\n<p>Trong quy tr\u00ecnh x\u1eed l\u00fd d\u1eef li\u1ec7u b\u1eb1ng Power BI, h\u00e0m CALCULATE ho\u1ea1t \u0111\u1ed9ng \u1edf giai \u0111o\u1ea1n ph\u00e2n t\u00edch. N\u00f3 gi\u00fap ki\u1ec3m so\u00e1t c\u00e1ch d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c \u0111\u00e1nh gi\u00e1 th\u00f4ng qua vi\u1ec7c \u0111i\u1ec1u ch\u1ec9nh <strong>filter context<\/strong>.<\/p>\n\n\n\n<p>Hi\u1ec3u m\u1ed9t c\u00e1ch \u0111\u01a1n gi\u1ea3n th\u00ec CALCULATE cho ph\u00e9p ta \u201c\u0111\u1ecbnh ngh\u0129a l\u1ea1i\u201d b\u1ed1i c\u1ea3nh t\u00ednh to\u00e1n c\u1ee7a m\u1ed9t bi\u1ec3u th\u1ee9c (th\u01b0\u1eddng l\u00e0 m\u1ed9t measure) b\u1eb1ng c\u00e1ch \u00e1p d\u1ee5ng m\u1ed9t t\u1eadp \u0111i\u1ec1u ki\u1ec7n l\u1ecdc m\u1edbi, c\u00f3 kh\u1ea3 n\u0103ng ghi \u0111\u00e8 ho\u1eb7c b\u1ed5 sung v\u00e0o ng\u1eef c\u1ea3nh l\u1ecdc m\u1eb7c \u0111\u1ecbnh c\u1ee7a b\u00e1o c\u00e1o.&nbsp;<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><em>\u0110\u1ecdc chi ti\u1ebft: <strong><a href=\"https:\/\/itviec.com\/blog\/power-bi-la-gi\/\" target=\"_blank\" rel=\"noreferrer noopener\">Power BI l\u00e0 g\u00ec? T\u1ed5ng quan, c\u00e1ch ho\u1ea1t \u0111\u1ed9ng v\u00e0 \u1ee9ng d\u1ee5ng th\u1ef1c t\u1ebf<\/a><\/strong><\/em><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-vi-sao-ham-calculate-quan-tr\u1ecdng\"><span class=\"ez-toc-section\" id=\"Vi_sao_ham_CALCULATE_quan_trong\"><\/span><strong>V\u00ec sao h\u00e0m CALCULATE quan tr\u1ecdng?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>C\u00e1c h\u00e0m t\u1ed5ng h\u1ee3p c\u01a1 b\u1ea3n nh\u01b0 SUM ch\u1ec9 th\u1ef1c hi\u1ec7n t\u00ednh to\u00e1n tr\u00ean t\u1eadp d\u1eef li\u1ec7u \u0111ang ch\u1ecbu \u1ea3nh h\u01b0\u1edfng c\u1ee7a filter hi\u1ec7n t\u1ea1i trong b\u00e1o c\u00e1o. B\u1ea1n kh\u00f4ng th\u1ec3 can thi\u1ec7p s\u00e2u v\u00e0o ph\u1ea1m vi d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c t\u00ednh.<\/p>\n\n\n\n<p>Trong khi \u0111\u00f3, h\u00e0m CALCULATE mang l\u1ea1i quy\u1ec1n ki\u1ec3m so\u00e1t cao h\u01a1n. B\u1ea1n c\u00f3 th\u1ec3 th\u00eam, thay \u0111\u1ed5i ho\u1eb7c lo\u1ea1i b\u1ecf filter m\u1ed9t c\u00e1ch ch\u1ee7 \u0111\u1ed9ng \u0111\u1ec3 \u0111\u1ea3m b\u1ea3o ph\u00e9p t\u00ednh \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n \u0111\u00fang tr\u00ean t\u1eadp d\u1eef li\u1ec7u mong mu\u1ed1n.&nbsp;<\/p>\n\n\n\n<p>Ch\u00ednh kh\u1ea3 n\u0103ng thao t\u00e1c linh ho\u1ea1t v\u1edbi filter context khi\u1ebfn CALCULATE tr\u1edf th\u00e0nh n\u1ec1n t\u1ea3ng c\u1ee7a c\u00e1c b\u00e0i to\u00e1n ph\u00e2n t\u00edch n\u00e2ng cao nh\u01b0:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>T\u00ednh doanh thu theo \u0111i\u1ec1u ki\u1ec7n c\u1ee5 th\u1ec3<\/li>\n\n\n\n<li>So s\u00e1nh s\u1ed1 li\u1ec7u theo th\u1eddi gian nh\u01b0 YoY ho\u1eb7c YTD<\/li>\n\n\n\n<li>X\u00e2y d\u1ef1ng KPI thay \u0111\u1ed5i theo slicer<\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><em>\u0110\u1ecdc chi ti\u1ebft: <strong><a href=\"https:\/\/itviec.com\/blog\/cach-su-dung-power-bi\/\" target=\"_blank\" rel=\"noreferrer noopener\">C\u00e1ch s\u1eed d\u1ee5ng Power BI hi\u1ec7u qu\u1ea3 v\u00e0 c\u00e1c best practices c\u1ea7n bi\u1ebft<\/a><\/strong><\/em><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-c\u1ea5u-truc-cu-phap-c\u1ee7a-calculate\"><span class=\"ez-toc-section\" id=\"Cau_truc_cu_phap_cua_CALCULATE\"><\/span><strong>C\u1ea5u tr\u00fac c\u00fa ph\u00e1p c\u1ee7a <\/strong>CALCULATE<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>C\u00fa ph\u00e1p t\u1ed5ng qu\u00e1t c\u1ee7a h\u00e0m CALCULATE nh\u01b0 sau:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CALCULATE(\n    &lt;expression&gt;,\n    &lt;filter1&gt;,\n    &lt;filter2&gt;,\n    ...\n)<\/code><\/pre>\n\n\n\n<p>Trong \u0111\u00f3:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&lt;expression&gt;: l\u00e0 bi\u1ec3u th\u1ee9c b\u1ea1n mu\u1ed1n t\u00ednh to\u00e1n, th\u01b0\u1eddng l\u00e0 m\u1ed9t measure ho\u1eb7c m\u1ed9t ph\u00e9p t\u1ed5ng h\u1ee3p nh\u01b0 SUM, AVERAGE, COUNT\u2026 \u0110\u00e2y l\u00e0 ph\u1ea7n \u201ck\u1ebft qu\u1ea3 cu\u1ed1i c\u00f9ng\u201d m\u00e0 b\u1ea1n mu\u1ed1n nh\u1eadn \u0111\u01b0\u1ee3c.<\/li>\n\n\n\n<li>&lt;filter&gt;: l\u00e0 m\u1ed9t ho\u1eb7c nhi\u1ec1u \u0111i\u1ec1u ki\u1ec7n l\u1ecdc m\u00e0 b\u1ea1n mu\u1ed1n \u00e1p d\u1ee5ng ho\u1eb7c thay \u0111\u1ed5i so v\u1edbi filter hi\u1ec7n t\u1ea1i c\u1ee7a b\u00e1o c\u00e1o. M\u1ed7i filter c\u00f3 th\u1ec3 l\u00e0 m\u1ed9t bi\u1ec3u th\u1ee9c logic ho\u1eb7c m\u1ed9t h\u00e0m l\u1ecdc nh\u01b0 ALL, FILTER, SAMEPERIODLASTYEAR\u2026<\/li>\n<\/ul>\n\n\n\n<p>Khi Power BI g\u1eb7p m\u1ed9t c\u00f4ng th\u1ee9c c\u00f3 h\u00e0m CALCULATE, n\u00f3 s\u1ebd th\u1ef1c hi\u1ec7n theo th\u1ee9 t\u1ef1 sau:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u0110\u00e1nh gi\u00e1 filter context hi\u1ec7n t\u1ea1i (ng\u1eef c\u1ea3nh \u0111ang \u0111\u01b0\u1ee3c \u00e1p d\u1ee5ng b\u1edfi visual, slicer, page filter\u2026).<\/li>\n\n\n\n<li>Th\u00eam, thay th\u1ebf ho\u1eb7c lo\u1ea1i b\u1ecf c\u00e1c b\u1ed9 l\u1ecdc m\u1edbi \u0111\u01b0\u1ee3c truy\u1ec1n v\u00e0o CALCULATE.<\/li>\n\n\n\n<li>T\u1ea1o m\u1ed9t filter context m\u1edbi t\u1ea1m th\u1eddi.<\/li>\n\n\n\n<li>Th\u1ef1c thi bi\u1ec3u th\u1ee9c (expression) trong ng\u1eef c\u1ea3nh m\u1edbi \u0111\u00f3.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-calculate-thay-d\u1ed5i-filter-context-nh\u01b0-th\u1ebf-nao\"><span class=\"ez-toc-section\" id=\"CALCULATE_thay_doi_filter_context_nhu_the_nao\"><\/span><strong>CALCULATE<\/strong> <strong>thay \u0111\u1ed5i filter context nh\u01b0 th\u1ebf n\u00e0o?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Filter context \u0111\u01a1n gi\u1ea3n l\u00e0 \u201cph\u1ea1m vi d\u1eef li\u1ec7u \u0111ang \u0111\u01b0\u1ee3c ch\u1ecdn \u0111\u1ec3 t\u00ednh to\u00e1n\u201d. Ph\u1ea1m vi n\u00e0y c\u00f3 th\u1ec3 \u0111\u1ebfn t\u1eeb slicer, filter tr\u00ean report, ho\u1eb7c t\u1eeb ch\u00ednh visual \u0111ang hi\u1ec3n th\u1ecb.&nbsp;<\/p>\n\n\n\n<p>V\u00ed d\u1ee5, n\u1ebfu b\u1ea1n \u0111ang ch\u1ecdn Year = 2024 tr\u00ean slicer, th\u00ec m\u1ecdi measure trong b\u00e1o c\u00e1o s\u1ebd ch\u1ec9 t\u00ednh tr\u00ean d\u1eef li\u1ec7u c\u1ee7a n\u0103m 2024. \u0110\u00f3 ch\u00ednh l\u00e0 filter context hi\u1ec7n t\u1ea1i.&nbsp;<\/p>\n\n\n\n<p>CALCULATE cho ph\u00e9p b\u1ea1n can thi\u1ec7p v\u00e0o ph\u1ea1m vi \u0111\u00f3 v\u00e0 n\u00f3 c\u00f3 th\u1ec3 th\u00eam \u0111i\u1ec1u ki\u1ec7n l\u1ecdc m\u1edbi, ghi \u0111\u00e8 \u0111i\u1ec1u ki\u1ec7n \u0111ang c\u00f3 ho\u1eb7c lo\u1ea1i b\u1ecf m\u1ed9t \u0111i\u1ec1u ki\u1ec7n l\u1ecdc v\u1edbi c\u00e1c c\u00e1ch ti\u1ebfp c\u1eadn nh\u01b0 sau:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-them-filter-m\u1edbi\"><strong>Th\u00eam filter m\u1edbi<\/strong><\/h3>\n\n\n\n<p>Gi\u1ea3 s\u1eed b\u00e1o c\u00e1o c\u1ee7a b\u1ea1n kh\u00f4ng c\u00f3 slicer l\u1ecdc theo n\u0103m, t\u1ee9c l\u00e0 \u0111ang hi\u1ec3n th\u1ecb to\u00e0n b\u1ed9 d\u1eef li\u1ec7u t\u1eeb 2021-2024:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sales 2023 =\nCALCULATE(\n    SUM(Sales&#91;Amount]),\n    Sales&#91;Year] = 2023\n)<\/code><\/pre>\n\n\n\n<p>=&gt; D\u00f9 ng\u01b0\u1eddi d\u00f9ng kh\u00f4ng ch\u1ecdn n\u0103m n\u00e0o, measure v\u1eabn lu\u00f4n tr\u1ea3 v\u1ec1 doanh thu n\u0103m 2023.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-ghi-de-filter-hi\u1ec7n-co\"><strong>Ghi \u0111\u00e8 filter hi\u1ec7n c\u00f3<\/strong><\/h3>\n\n\n\n<p>Gi\u1ea3 s\u1eed tr\u00ean slicer, ng\u01b0\u1eddi d\u00f9ng \u0111ang ch\u1ecdn Year = 2022. Th\u00f4ng th\u01b0\u1eddng, measure s\u1ebd l\u00e0:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Total Sales = SUM(Sales&#91;Amount])<\/code><\/pre>\n\n\n\n<p>=&gt; Tr\u1ea3 v\u1ec1 doanh thu n\u0103m 2022 v\u00ec \u0111\u00f3 l\u00e0 filter context hi\u1ec7n t\u1ea1i. Nh\u01b0ng n\u1ebfu ta vi\u1ebft:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sales 2023 =\nCALCULATE(\n    SUM(Sales&#91;Amount]),\n    Sales&#91;Year] = 2023\n)<\/code><\/pre>\n\n\n\n<p>Quy tr\u00ecnh s\u1ebd nh\u01b0 sau: 1. Slicer \u00e1p d\u1ee5ng filter Year = 2022; 2. CALCULATE nh\u1eadn \u0111i\u1ec1u ki\u1ec7n m\u1edbi Year = 2023; 3. V\u00ec c\u00f9ng m\u1ed9t c\u1ed9t (Year), filter m\u1edbi s\u1ebd ghi \u0111\u00e8 filter c\u0169; 4. Power BI t\u00ednh l\u1ea1i t\u1ed5ng tr\u00ean d\u1eef li\u1ec7u n\u0103m 2023.<\/p>\n\n\n\n<p>=&gt; K\u1ebft qu\u1ea3 l\u00e0 d\u00f9 slicer \u0111ang ch\u1ecdn 2022, measure v\u1eabn tr\u1ea3 v\u1ec1 doanh thu 2023. \u0110\u00e2y l\u00e0 \u0111i\u1ec3m nhi\u1ec1u ng\u01b0\u1eddi m\u1edbi h\u1ecdc DAX d\u1ec5 nh\u1ea7m l\u1eabn l\u00e0 CALCULATE c\u00f3 th\u1ec3 \u01b0u ti\u00ean filter b\u00ean trong n\u00f3 h\u01a1n filter t\u1eeb report.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-lo\u1ea1i-b\u1ecf-filter\"><strong>Lo\u1ea1i b\u1ecf filter<\/strong><\/h3>\n\n\n\n<p>Gi\u1ea3 s\u1eed ng\u01b0\u1eddi d\u00f9ng \u0111ang ch\u1ecdn Year = 2024 tr\u00ean slicer. Ta mu\u1ed1n t\u1ea1o m\u1ed9t measure lu\u00f4n hi\u1ec3n th\u1ecb t\u1ed5ng doanh thu c\u1ee7a t\u1ea5t c\u1ea3 c\u00e1c n\u0103m, b\u1ea5t k\u1ec3 slicer \u0111ang ch\u1ecdn g\u00ec th\u00ec ta s\u1ebd vi\u1ebft:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Total Sales All Years =\nCALCULATE(\n    SUM(Sales&#91;Amount]),\n    ALL(Sales&#91;Year])\n)<\/code><\/pre>\n\n\n\n<p>=&gt; \u1ede \u0111\u00e2y, CALCULATE kh\u00f4ng th\u00eam filter, kh\u00f4ng ghi \u0111\u00e8 gi\u00e1 tr\u1ecb c\u1ee5 th\u1ec3 m\u00e0 lo\u1ea1i b\u1ecf ho\u00e0n to\u00e0n filter tr\u00ean c\u1ed9t \u0111\u00f3. Measure s\u1ebd lu\u00f4n hi\u1ec3n th\u1ecb t\u1ed5ng doanh thu to\u00e0n b\u1ed9 c\u00e1c n\u0103m (2021\u20132024), kh\u00f4ng b\u1ecb \u1ea3nh h\u01b0\u1edfng b\u1edfi slicer n\u0103m.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-vi-d\u1ee5-s\u1eed-d\u1ee5ng-ham-calculate-trong-power-bi\"><span class=\"ez-toc-section\" id=\"Vi_du_su_dung_ham_CALCULATE_trong_Power_BI\"><\/span><strong>V\u00ed d\u1ee5 s\u1eed d\u1ee5ng h\u00e0m CALCULATE trong Power BI<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-ap-d\u1ee5ng-m\u1ed9t-di\u1ec1u-ki\u1ec7n-l\u1ecdc-single-filter-criteria\"><strong>\u00c1p d\u1ee5ng m\u1ed9t \u0111i\u1ec1u ki\u1ec7n l\u1ecdc (Single Filter Criteria)<\/strong><\/h3>\n\n\n\n<p>\u0110\u00e2y l\u00e0 tr\u01b0\u1eddng h\u1ee3p \u0111\u01a1n gi\u1ea3n nh\u1ea5t: \u00e1p d\u1ee5ng m\u1ed9t \u0111i\u1ec1u ki\u1ec7n l\u1ecdc duy nh\u1ea5t tr\u01b0\u1edbc khi t\u00ednh to\u00e1n. Gi\u1ea3 s\u1eed ta \u0111\u00e3 c\u00f3 measure t\u1ed5ng doanh thu:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Total Sales =\nSUM ( Sales&#91;Amount] )<\/code><\/pre>\n\n\n\n<p>B\u00e2y gi\u1edd b\u1ea1n mu\u1ed1n t\u00ednh doanh thu ch\u1ec9 c\u1ee7a s\u1ea3n ph\u1ea9m \u201cLaptop\u201d.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Laptop Sales =\nCALCULATE (\n    &#91;Total Sales],\n    Products&#91;Category] = \"Laptop\"\n)<\/code><\/pre>\n\n\n\n<p>=&gt; \u1ede \u0111\u00e2y, CALCULATE s\u1ebd t\u1ea1o m\u1ed9t filter context m\u1edbi v\u1edbi \u0111i\u1ec1u ki\u1ec7n Category = Laptop, sau \u0111\u00f3 t\u00ednh l\u1ea1i [Total Sales] trong b\u1ed1i c\u1ea3nh \u0111\u00f3 n\u00ean d\u00f9 ng\u01b0\u1eddi d\u00f9ng \u0111ang xem to\u00e0n b\u1ed9 s\u1ea3n ph\u1ea9m, measure n\u00e0y v\u1eabn ch\u1ec9 t\u00ednh ri\u00eang Laptop.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-ghi-de-ho\u1eb7c-b\u1ecf-qua-b\u1ed9-l\u1ecdc-v\u1edbi-all\"><strong>Ghi \u0111\u00e8 ho\u1eb7c b\u1ecf qua b\u1ed9 l\u1ecdc v\u1edbi <\/strong>ALL()<\/h3>\n\n\n\n<p>M\u1ed9t trong nh\u1eefng s\u1ee9c m\u1ea1nh l\u1edbn nh\u1ea5t c\u1ee7a CALCULATE l\u00e0 kh\u1ea3 n\u0103ng x\u00f3a ho\u1eb7c ghi \u0111\u00e8 filter hi\u1ec7n c\u00f3 b\u1eb1ng h\u00e0m ALL(). V\u00ed d\u1ee5 b\u1ea1n mu\u1ed1n lu\u00f4n hi\u1ec3n th\u1ecb t\u1ed5ng doanh thu to\u00e0n c\u00f4ng ty, b\u1ea5t k\u1ec3 ng\u01b0\u1eddi d\u00f9ng \u0111ang l\u1ecdc s\u1ea3n ph\u1ea9m n\u00e0o.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Total Company Sales =\nCALCULATE (\n    &#91;Total Sales],\n    ALL ( Products )\n)<\/code><\/pre>\n\n\n\n<p>=&gt; H\u00e0m ALL(Products) s\u1ebd lo\u1ea1i b\u1ecf m\u1ecdi filter li\u00ean quan \u0111\u1ebfn b\u1ea3ng Products. \u0110i\u1ec1u n\u00e0y c\u00f3 ngh\u0129a l\u00e0 n\u1ebfu ng\u01b0\u1eddi d\u00f9ng ch\u1ecdn \u201cLaptop\u201d ho\u1eb7c ch\u1ecdn \u201cPhone\u201d ho\u1eb7c l\u1ecdc theo b\u1ea5t k\u1ef3 danh m\u1ee5c n\u00e0o, k\u1ebft qu\u1ea3 v\u1eabn l\u00e0 t\u1ed5ng doanh thu c\u1ee7a t\u1ea5t c\u1ea3 s\u1ea3n ph\u1ea9m. \u0110\u00e2y l\u00e0 c\u00e1ch th\u01b0\u1eddng d\u00f9ng khi c\u1ea7n t\u00ednh % t\u1ed5ng ho\u1eb7c so s\u00e1nh gi\u1eefa m\u1ed9t ph\u1ea7n v\u00e0 to\u00e0n b\u1ed9.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-ap-d\u1ee5ng-nhi\u1ec1u-di\u1ec1u-ki\u1ec7n-l\u1ecdc-multiple-filter-criteria\"><strong>\u00c1p d\u1ee5ng nhi\u1ec1u \u0111i\u1ec1u ki\u1ec7n l\u1ecdc (Multiple Filter Criteria)<\/strong><\/h3>\n\n\n\n<p>Ngo\u00e0i ra, CALCULATE c\u00f2n cho ph\u00e9p ta th\u00eam nhi\u1ec1u \u0111i\u1ec1u ki\u1ec7n l\u1ecdc c\u00f9ng l\u00fac v\u00e0 c\u00e1c \u0111i\u1ec1u ki\u1ec7n n\u00e0y ho\u1ea1t \u0111\u1ed9ng theo logic AND.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Laptop Hanoi Sales =\nCALCULATE (\n    &#91;Total Sales],\n    Products&#91;Category] = \"Laptop\",\n    Stores&#91;City] = \"Hanoi\"\n)<\/code><\/pre>\n\n\n\n<p>=&gt; Trong \u0111\u00f3, Power BI s\u1ebd:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>L\u1ecdc Category = Laptop<\/li>\n\n\n\n<li>L\u1ecdc City = Hanoi<\/li>\n\n\n\n<li>Sau \u0111\u00f3 t\u00ednh [Total Sales]<\/li>\n<\/ol>\n\n\n\n<p>Ch\u1ec9 nh\u1eefng d\u00f2ng th\u1ecfa m\u00e3n c\u1ea3 hai \u0111i\u1ec1u ki\u1ec7n m\u1edbi \u0111\u01b0\u1ee3c t\u00ednh.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-\u1ee9ng-d\u1ee5ng-nang-cao-v\u1edbi-cac-ham-phan-tich-theo-th\u1eddi-gian-time-intelligence\"><strong>\u1ee8ng d\u1ee5ng n\u00e2ng cao v\u1edbi c\u00e1c h\u00e0m ph\u00e2n t\u00edch theo th\u1eddi gian (Time Intelligence)<\/strong><\/h3>\n\n\n\n<p>M\u1ed9t trong nh\u1eefng \u1ee9ng d\u1ee5ng m\u1ea1nh nh\u1ea5t c\u1ee7a CALCULATE l\u00e0 trong Time Intelligence &#8211; c\u00e1c ph\u00e9p t\u00ednh theo th\u1eddi gian nh\u01b0 YTD, MTD, YoY. Gi\u1ea3 s\u1eed b\u1ea1n c\u1ea7n t\u00ednh doanh thu c\u00f9ng k\u1ef3 n\u0103m tr\u01b0\u1edbc:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sales Last Year =\nCALCULATE (\n    &#91;Total Sales],\n    SAMEPERIODLASTYEAR ( 'Date'&#91;Date] )\n)<\/code><\/pre>\n\n\n\n<p>Ho\u1eb7c t\u00ednh doanh thu t\u1eeb \u0111\u1ea7u n\u0103m \u0111\u1ebfn hi\u1ec7n t\u1ea1i:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sales YTD =\nCALCULATE (\n    &#91;Total Sales],\n    DATESYTD ( 'Date'&#91;Date] )\n)<\/code><\/pre>\n\n\n\n<p>=&gt; V\u1edbi 2 v\u00ed d\u1ee5 tr\u00ean, h\u00e0m th\u1eddi gian thay \u0111\u1ed5i filter context c\u1ee7a c\u1ed9t Date v\u00e0 CALCULATE th\u1ef1c hi\u1ec7n ph\u00e9p t\u00ednh trong b\u1ed1i c\u1ea3nh th\u1eddi gian m\u1edbi. Nh\u1edd v\u1eady, ta c\u00f3 th\u1ec3 t\u1ea1o c\u00e1c ch\u1ec9 s\u1ed1 nh\u01b0 YoY Growth, YTD, MTD ch\u1ec9 v\u1edbi v\u00e0i d\u00f2ng DAX thay v\u00ec vi\u1ebft c\u00f4ng th\u1ee9c ph\u1ee9c t\u1ea1p.<\/p>\n\n\n\n<p>L\u01b0u \u00fd: C\u00e1c h\u00e0m nh\u01b0 SAMEPERIODLASTYEAR hay DATESYTD ch\u1ec9 ho\u1ea1t \u0111\u1ed9ng ch\u00ednh x\u00e1c khi tham s\u1ed1 truy\u1ec1n v\u00e0o l\u00e0 m\u1ed9t c\u1ed9t ng\u00e0y.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-nh\u1eefng-ham-th\u01b0\u1eddng-dung-cung-ham-calculate-trong-power-bi\"><span class=\"ez-toc-section\" id=\"Nhung_ham_thuong_dung_cung_ham_CALCULATE_trong_Power_BI\"><\/span><strong>Nh\u1eefng h\u00e0m th\u01b0\u1eddng d\u00f9ng c\u00f9ng h\u00e0m CALCULATE trong Power BI<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-nhom-ham-lo\u1ea1i-b\u1ecf-ho\u1eb7c-di\u1ec1u-ch\u1ec9nh-filter\"><strong>Nh\u00f3m h\u00e0m lo\u1ea1i b\u1ecf ho\u1eb7c \u0111i\u1ec1u ch\u1ec9nh filter<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>ALL(): D\u00f9ng \u0111\u1ec3 lo\u1ea1i b\u1ecf filter tr\u00ean m\u1ed9t ho\u1eb7c nhi\u1ec1u c\u1ed9t\/b\u1ea3ng v\u00e0 th\u01b0\u1eddng d\u00f9ng khi t\u00ednh % tr\u00ean t\u1ed5ng ho\u1eb7c t\u1ed5ng to\u00e0n c\u1ee5c.<\/li>\n\n\n\n<li>REMOVEFILTERS(): c\u00f3 ch\u1ee9c n\u0103ng t\u01b0\u01a1ng t\u1ef1 ALL(), chuy\u00ean d\u00f9ng \u0111\u1ec3 x\u00f3a filter. Gi\u1ea3 s\u1eed b\u1ea1n mu\u1ed1n \u201cb\u1ecf filter\u201d tr\u00ean m\u1ed9t c\u1ed9t\/b\u1ea3ng cho r\u00f5 ngh\u0129a h\u01a1n trong code (nh\u00ecn v\u00e0o bi\u1ebft ngay m\u1ee5c ti\u00eau l\u00e0 x\u00f3a filter):<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>Total Sales No Product Filter =\nCALCULATE (\n    &#91;Total Sales],\n    REMOVEFILTERS ( Product )\n)<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>ALLEXCEPT(): Gi\u1eef l\u1ea1i filter tr\u00ean m\u1ed9t s\u1ed1 c\u1ed9t v\u00e0 lo\u1ea1i b\u1ecf filter tr\u00ean c\u00e1c c\u1ed9t kh\u00e1c c\u1ee7a c\u00f9ng b\u1ea3ng \u0111\u00f3. Gi\u1ea3 s\u1eed b\u1ea1n c\u00f3 nhi\u1ec1u slicer nh\u01b0 Year, Month, Product, Region. B\u1ea1n mu\u1ed1n t\u00ednh doanh thu theo Region, nh\u01b0ng b\u1ecf qua c\u00e1c filter kh\u00e1c (Year\/Month\/Product\u2026) th\u00ec ta d\u00f9ng c\u00fa ph\u00e1p:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>Sales by Region (Ignore Others) =\nCALCULATE(\n    SUM(Sales&#91;Amount]),\n    ALLEXCEPT(Sales, Sales&#91;Region])\n)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-nhom-ham-l\u1ecdc-nang-cao\"><strong>Nh\u00f3m h\u00e0m l\u1ecdc n\u00e2ng cao<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>FILTER(): Cho ph\u00e9p t\u1ea1o \u0111i\u1ec1u ki\u1ec7n l\u1ecdc ph\u1ee9c t\u1ea1p h\u01a1n thay v\u00ec ch\u1ec9 so s\u00e1nh \u0111\u01a1n gi\u1ea3n.<\/li>\n\n\n\n<li>KEEPFILTERS(): gi\u00fap gi\u1eef l\u1ea1i filter c\u0169 v\u00e0 th\u00eam \u0111i\u1ec1u ki\u1ec7n m\u1edbi v\u00e0o. Gi\u1ea3 s\u1eed trang b\u00e1o c\u00e1o \u0111ang c\u00f3 slicer Region, ng\u01b0\u1eddi d\u00f9ng ch\u1ecdn \u201cNorth + South\u201d. B\u1ea1n mu\u1ed1n measure ch\u1ec9 t\u00ednh ri\u00eang \u201cNorth\u201d, nh\u01b0ng v\u1eabn t\u00f4n tr\u1ecdng c\u00e1c filter kh\u00e1c \u0111ang c\u00f3 (v\u00ed d\u1ee5 Year, Product\u2026) th\u00ec d\u00f9ng c\u00fa ph\u00e1p:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>Sales North Only =\nCALCULATE (\n    &#91;Total Sales],\n    KEEPFILTERS ( Sales&#91;Region] = \"North\" )\n)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-nhom-ham-ki\u1ec3m-soat-ng\u1eef-c\u1ea3nh\"><strong>Nh\u00f3m h\u00e0m ki\u1ec3m so\u00e1t ng\u1eef c\u1ea3nh<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>VALUES(): Tr\u1ea3 v\u1ec1 t\u1eadp gi\u00e1 tr\u1ecb duy nh\u1ea5t c\u1ee7a m\u1ed9t c\u1ed9t trong filter context hi\u1ec7n t\u1ea1i.<\/li>\n\n\n\n<li>SELECTEDVALUE(): Tr\u1ea3 v\u1ec1 gi\u00e1 tr\u1ecb \u0111ang \u0111\u01b0\u1ee3c ch\u1ecdn (th\u01b0\u1eddng d\u00f9ng v\u1edbi slicer). Gi\u1ea3 s\u1eed b\u1ea1n c\u00f3 slicer ch\u1ecdn Year v\u00e0 b\u1ea1n mu\u1ed1n t\u1ea1o m\u1ed9t measure ph\u1ea3n \u1ee9ng theo n\u0103m \u0111ang ch\u1ecdn (v\u00e0 n\u1ebfu kh\u00f4ng ch\u1ecdn th\u00ec c\u00f3 th\u1ec3 tr\u1ea3 BLANK ho\u1eb7c m\u1ed9t m\u1eb7c \u0111\u1ecbnh), ta d\u00f9ng c\u00fa ph\u00e1p:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>Sales Selected Year =\nCALCULATE(\n    SUM(Sales&#91;Amount]),\n    Sales&#91;Year] = SELECTEDVALUE(Sales&#91;Year])\n)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-nhom-ham-time-intelligence\"><strong>Nh\u00f3m h\u00e0m Time Intelligence<\/strong><\/h3>\n\n\n\n<p>\u0110\u00e2y l\u00e0 nh\u00f3m h\u00e0m \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng r\u1ea5t ph\u1ed5 bi\u1ebfn c\u00f9ng CALCULATE \u0111\u1ec3 x\u1eed l\u00fd d\u1eef li\u1ec7u theo th\u1eddi gian:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>DATESYTD(): Tr\u1ea3 v\u1ec1 t\u1eadp h\u1ee3p c\u00e1c ng\u00e0y t\u1eeb \u0111\u1ea7u n\u0103m \u0111\u1ebfn ng\u00e0y hi\u1ec7n t\u1ea1i trong filter context (Year-to-Date).<\/li>\n\n\n\n<li>DATESMTD(): Tr\u1ea3 v\u1ec1 t\u1eadp h\u1ee3p c\u00e1c ng\u00e0y t\u1eeb \u0111\u1ea7u th\u00e1ng \u0111\u1ebfn ng\u00e0y hi\u1ec7n t\u1ea1i trong filter context (Month-to-Date).<\/li>\n\n\n\n<li>SAMEPERIODLASTYEAR(): Tr\u1ea3 v\u1ec1 t\u1eadp h\u1ee3p ng\u00e0y t\u01b0\u01a1ng \u1ee9ng c\u00f9ng k\u1ef3 c\u1ee7a n\u0103m tr\u01b0\u1edbc \u0111\u1ec3 so s\u00e1nh t\u0103ng tr\u01b0\u1edfng theo n\u0103m (YoY).<\/li>\n\n\n\n<li>DATEADD(): D\u1ecbch chuy\u1ec3n t\u1eadp ng\u00e0y hi\u1ec7n t\u1ea1i l\u00f9i ho\u1eb7c ti\u1ebfn m\u1ed9t kho\u1ea3ng th\u1eddi gian x\u00e1c \u0111\u1ecbnh (v\u00ed d\u1ee5 -1 n\u0103m, -1 th\u00e1ng) \u0111\u1ec3 ph\u1ee5c v\u1ee5 ph\u00e2n t\u00edch so s\u00e1nh.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-l\u1ed7i-th\u01b0\u1eddng-g\u1eb7p-khi-dung-calculate\"><span class=\"ez-toc-section\" id=\"Loi_thuong_gap_khi_dung_CALCULATE\"><\/span><strong>L\u1ed7i th\u01b0\u1eddng g\u1eb7p khi d\u00f9ng CALCULATE<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-khong-hi\u1ec3u-ro-filter-context\"><strong>Kh\u00f4ng hi\u1ec3u r\u00f5 Filter Context<\/strong><\/h3>\n\n\n\n<p>\u0110\u00e2y l\u00e0 l\u1ed7i ph\u1ed5 bi\u1ebfn nh\u1ea5t v\u00ec nhi\u1ec1u ng\u01b0\u1eddi ch\u1ec9 t\u1eadp trung v\u00e0o c\u00f4ng th\u1ee9c m\u00e0 qu\u00ean r\u1eb1ng \u201cCALCULATE lu\u00f4n thay \u0111\u1ed5i filter tr\u01b0\u1edbc r\u1ed3i m\u1edbi t\u00ednh bi\u1ec3u th\u1ee9c\u201d. Khi k\u1ebft qu\u1ea3 \u201ckh\u00f4ng gi\u1ed1ng slicer\u201d, th\u01b0\u1eddng nguy\u00ean nh\u00e2n l\u00e0 v\u00ec filter b\u00ean trong CALCULATE \u0111\u00e3 ghi \u0111\u00e8 ho\u1eb7c lo\u1ea1i b\u1ecf filter t\u1eeb report.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-l\u1ea1m-d\u1ee5ng-filter-gay-ch\u1eadm-hi\u1ec7u-nang\"><strong>L\u1ea1m d\u1ee5ng FILTER() g\u00e2y ch\u1eadm hi\u1ec7u n\u0103ng<\/strong><\/h3>\n\n\n\n<p><code>FILTER()<\/code> s\u1ebd t\u1ea1o m\u1ed9t b\u1ea3ng trung gian tr\u01b0\u1edbc khi t\u00ednh to\u00e1n n\u00ean n\u1ebfu d\u00f9ng tr\u00ean b\u1ea3ng l\u1edbn (h\u00e0ng tri\u1ec7u d\u00f2ng), c\u00f3 th\u1ec3 l\u00e0m b\u00e1o c\u00e1o ch\u1eadm \u0111\u00e1ng k\u1ec3. V\u00ec v\u1eady n\u1ebfu \u0111i\u1ec1u ki\u1ec7n \u0111\u01a1n gi\u1ea3n (Column = Value), n\u00ean vi\u1ebft tr\u1ef1c ti\u1ebfp thay v\u00ec d\u00f9ng FILTER.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-ghi-de-filter-ngoai-y-mu\u1ed1n\"><strong>Ghi \u0111\u00e8 filter ngo\u00e0i \u00fd mu\u1ed1n<\/strong><\/h3>\n\n\n\n<p>Gi\u1ea3 s\u1eed ta c\u00f3:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sales 2023 =\nCALCULATE(\n    SUM(Sales&#91;Amount]),\n    Sales&#91;Year] = 2023\n)<\/code><\/pre>\n\n\n\n<p>=&gt; N\u1ebfu slicer \u0111ang ch\u1ecdn Year = 2024, measure n\u00e0y v\u1eabn tr\u1ea3 v\u1ec1 2023. Nhi\u1ec1u ng\u01b0\u1eddi ngh\u0129 slicer b\u1ecb l\u1ed7i, nh\u01b0ng th\u1ef1c t\u1ebf l\u00e0 filter trong CALCULATE \u0111\u00e3 ghi \u0111\u00e8 filter hi\u1ec7n t\u1ea1i. C\u1ea7n hi\u1ec3u r\u1eb1ng filter trong CALCULATE c\u00f3 \u0111\u1ed9 \u01b0u ti\u00ean cao h\u01a1n filter t\u1eeb visual\/slicer khi c\u00f9ng m\u1ed9t c\u1ed9t.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-nh\u1ea7m-l\u1eabn-gi\u1eefa-row-context-va-filter-context\"><strong>Nh\u1ea7m l\u1eabn gi\u1eefa Row Context v\u00e0 Filter Context<\/strong><\/h3>\n\n\n\n<p>CALCULATE ho\u1ea1t \u0111\u1ed9ng tr\u00ean filter context, kh\u00f4ng ph\u1ea3i row context. Khi d\u00f9ng CALCULATE trong calculated column m\u00e0 kh\u00f4ng hi\u1ec3u context transition, k\u1ebft qu\u1ea3 c\u00f3 th\u1ec3 sai ho\u00e0n to\u00e0n. CALCULATE trong calculated column s\u1ebd chuy\u1ec3n row context th\u00e0nh filter context (context transition), \u0111\u00e2y l\u00e0 \u0111i\u1ec3m n\u00e2ng cao nh\u01b0ng r\u1ea5t quan tr\u1ecdng trong ph\u1ecfng v\u1ea5n.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-khong-co-b\u1ea3ng-date-chu\u1ea9n-khi-dung-time-intelligence\"><strong>Kh\u00f4ng c\u00f3 b\u1ea3ng Date chu\u1ea9n khi d\u00f9ng Time Intelligence<\/strong><\/h3>\n\n\n\n<p>C\u00e1c h\u00e0m nh\u01b0 <code>DATESYTD()<\/code>, <code>SAMEPERIODLASTYEAR()<\/code> y\u00eau c\u1ea7u m\u1ed9t b\u1ea3ng Date ri\u00eang, \u0111\u01b0\u1ee3c \u0111\u00e1nh d\u1ea5u l\u00e0 Date Table v\u00e0 quan h\u1ec7 \u0111\u00fang v\u1edbi b\u1ea3ng fact. N\u1ebfu kh\u00f4ng c\u00f3, measure s\u1ebd cho k\u1ebft qu\u1ea3 sai ho\u1eb7c kh\u00f4ng ho\u1ea1t \u0111\u1ed9ng \u0111\u00fang.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cac-cau-h\u1ecfi-th\u01b0\u1eddng-g\u1eb7p-v\u1ec1-ham-calculate-trong-power-bi\"><span class=\"ez-toc-section\" id=\"Cac_cau_hoi_thuong_gap_ve_ham_CALCULATE_trong_Power_BI\"><\/span><strong>C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 h\u00e0m CALCULATE trong Power BI<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-ham-calculate-co-gi-khac-v\u1edbi-ham-sumx\"><span class=\"ez-toc-section\" id=\"Ham_CALCULATE_co_gi_khac_voi_ham_SUMX\"><\/span><strong>H\u00e0m CALCULATE c\u00f3 g\u00ec kh\u00e1c v\u1edbi h\u00e0m SUMX?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>CALCULATE v\u00e0 SUMX \u0111\u1ec1u l\u00e0 nh\u1eefng h\u00e0m quan tr\u1ecdng trong DAX, nh\u01b0ng ch\u00fang ph\u1ee5c v\u1ee5 hai m\u1ee5c \u0111\u00edch ho\u00e0n to\u00e0n kh\u00e1c nhau: SUMX x\u1eed l\u00fd logic t\u00ednh to\u00e1n \u1edf c\u1ea5p \u0111\u1ed9 d\u00f2ng d\u1eef li\u1ec7u, c\u00f2n CALCULATE x\u1eed l\u00fd logic \u1edf c\u1ea5p \u0111\u1ed9 ng\u1eef c\u1ea3nh l\u1ecdc.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>H\u00e0m CALCULATE gi\u00fap thay \u0111\u1ed5i filter context \u0111\u1ec3 ki\u1ec3m so\u00e1t ph\u1ea1m vi d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c t\u00ednh to\u00e1n, c\u00f2n SUMX l\u00e0 m\u1ed9t iterator function, t\u1ee9c l\u00e0 h\u00e0m l\u1eb7p qua t\u1eebng d\u00f2ng d\u1eef li\u1ec7u \u0111\u1ec3 th\u1ef1c hi\u1ec7n t\u00ednh to\u00e1n tr\u01b0\u1edbc khi t\u1ed5ng h\u1ee3p k\u1ebft qu\u1ea3.&nbsp;<\/li>\n\n\n\n<li>CALCULATE kh\u00f4ng tr\u1ef1c ti\u1ebfp th\u1ef1c hi\u1ec7n ph\u00e9p c\u1ed9ng hay ph\u00e9p t\u00ednh theo t\u1eebng d\u00f2ng. Thay v\u00e0o \u0111\u00f3, n\u00f3 \u0111\u00e1nh gi\u00e1 m\u1ed9t bi\u1ec3u th\u1ee9c (th\u01b0\u1eddng l\u00e0 m\u1ed9t measure) d\u01b0\u1edbi m\u1ed9t b\u1ed1i c\u1ea3nh l\u1ecdc m\u1edbi.&nbsp;<\/li>\n\n\n\n<li>Tr\u1ecdng t\u00e2m c\u1ee7a CALCULATE n\u1eb1m \u1edf vi\u1ec7c thay \u0111\u1ed5i \u0111i\u1ec1u ki\u1ec7n l\u1ecdc. Trong khi \u0111\u00f3, SUMX t\u1ea1o ra row context b\u1eb1ng c\u00e1ch duy\u1ec7t t\u1eebng d\u00f2ng trong m\u1ed9t b\u1ea3ng, t\u00ednh to\u00e1n m\u1ed9t bi\u1ec3u th\u1ee9c cho t\u1eebng d\u00f2ng, sau \u0111\u00f3 m\u1edbi c\u1ed9ng t\u1ed5ng c\u00e1c k\u1ebft qu\u1ea3 l\u1ea1i.&nbsp;<\/li>\n<\/ul>\n\n\n\n<p>Gi\u1ea3 s\u1eed ta c\u00f3 b\u1ea3ng Sales g\u1ed3m:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Product<\/strong><\/td><td><strong>Quantity<\/strong><\/td><td><strong>UnitPrice<\/strong><\/td><td><strong>Year<\/strong><\/td><\/tr><tr><td>A<\/td><td>10<\/td><td>5<\/td><td>2025<\/td><\/tr><tr><td>B<\/td><td>20<\/td><td>4<\/td><td>2025<\/td><\/tr><tr><td>C<\/td><td>15<\/td><td>6<\/td><td>2026<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>N\u1ebfu c\u1ea7n t\u00ednh Doanh thu = Quantity \u00d7 Unit Price, ta kh\u00f4ng th\u1ec3 d\u00f9ng SUM \u0111\u01a1n thu\u1ea7n m\u00e0 c\u1ea7n SUMX \u0111\u1ec3 t\u00ednh t\u1eebng d\u00f2ng r\u1ed3i c\u1ed9ng l\u1ea1i:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Total Revenue = \nSUMX(\n    Sales,\n    Sales&#91;Quantity] * Sales&#91;UnitPrice]\n)<\/code><\/pre>\n\n\n\n<p>N\u1ebfu ch\u1ec9 d\u00f9ng <code>SUM(Quantity) * SUM(UnitPrice)<\/code> th\u00ec s\u1ebd sai logic v\u00ec ph\u00e9p nh\u00e2n ph\u1ea3i th\u1ef1c hi\u1ec7n theo t\u1eebng d\u00f2ng. C\u00f2n n\u1ebfu ta mu\u1ed1n t\u00ednh Doanh thu ch\u1ec9 cho n\u0103m 2026, ta s\u1ebd d\u00f9ng CALCULATE \u0111\u1ec3 th\u00eam \u0111i\u1ec1u ki\u1ec7n l\u1ecdc n\u0103m:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Revenue 2026 = \nCALCULATE(\n    &#91;Total Revenue],\n    Sales&#91;Year] = 2026\n)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-calculate-co-thay-d\u1ed5i-d\u1eef-li\u1ec7u-g\u1ed1c-trong-power-bi-khong\">CALCULATE <strong>c\u00f3 thay \u0111\u1ed5i d\u1eef li\u1ec7u g\u1ed1c trong Power BI kh\u00f4ng?<\/strong><\/h3>\n\n\n\n<p>CALCULATE kh\u00f4ng thay \u0111\u1ed5i, ch\u1ec9nh s\u1eeda hay ghi \u0111\u00e8 d\u1eef li\u1ec7u g\u1ed1c trong b\u1ea3ng. H\u00e0m n\u00e0y ch\u1ec9 thay \u0111\u1ed5i filter context t\u1ea1i th\u1eddi \u0111i\u1ec3m t\u00ednh to\u00e1n measure. N\u00f3i c\u00e1ch kh\u00e1c, CALCULATE ch\u1ec9 \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn c\u00e1ch d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c \u0111\u00e1nh gi\u00e1, ch\u1ee9 kh\u00f4ng l\u00e0m thay \u0111\u1ed5i d\u1eef li\u1ec7u v\u1eadt l\u00fd trong m\u00f4 h\u00ecnh.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-vi\u1ec7c-s\u1eed-d\u1ee5ng-calculate-co-\u1ea3nh-h\u01b0\u1edfng-d\u1ebfn-hi\u1ec7u-nang-bao-cao-khong\"><strong>Vi\u1ec7c s\u1eed d\u1ee5ng CALCULATE c\u00f3 \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn hi\u1ec7u n\u0103ng b\u00e1o c\u00e1o kh\u00f4ng?<\/strong><\/h3>\n\n\n\n<p>C\u00f3 th\u1ec3, t\u00f9y c\u00e1ch s\u1eed d\u1ee5ng.<strong> <\/strong>B\u1ea3n th\u00e2n CALCULATE kh\u00f4ng ph\u1ea3i l\u00e0 h\u00e0m \u201cch\u1eadm\u201d, nh\u01b0ng n\u1ebfu k\u1ebft h\u1ee3p v\u1edbi c\u00e1c h\u00e0m nh\u01b0 FILTER tr\u00ean b\u1ea3ng l\u1edbn ho\u1eb7c lo\u1ea1i b\u1ecf filter qu\u00e1 r\u1ed9ng (ALL to\u00e0n b\u1ea3ng), n\u00f3 c\u00f3 th\u1ec3 l\u00e0m t\u0103ng kh\u1ed1i l\u01b0\u1ee3ng t\u00ednh to\u00e1n v\u00e0 khi\u1ebfn report ch\u1eadm h\u01a1n. Hi\u1ec7u n\u0103ng ph\u1ee5 thu\u1ed9c nhi\u1ec1u h\u01a1n v\u00e0o:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>M\u00f4 h\u00ecnh d\u1eef li\u1ec7u<\/li>\n\n\n\n<li>S\u1ed1 l\u01b0\u1ee3ng d\u00f2ng d\u1eef li\u1ec7u<\/li>\n\n\n\n<li>C\u00e1ch vi\u1ebft \u0111i\u1ec1u ki\u1ec7n filter<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-co-b\u1eaft-bu\u1ed9c-ph\u1ea3i-dung-calculate-trong-m\u1ecdi-measure-khong\"><strong>C\u00f3 b\u1eaft bu\u1ed9c ph\u1ea3i d\u00f9ng <\/strong>CALCULATE <strong>trong m\u1ecdi measure kh\u00f4ng?<\/strong><\/h3>\n\n\n\n<p>Kh\u00f4ng b\u1eaft bu\u1ed9c. N\u1ebfu b\u1ea1n ch\u1ec9 c\u1ea7n ph\u00e9p t\u00ednh \u0111\u01a1n gi\u1ea3n nh\u01b0 d\u01b0\u1edbi \u0111\u00e2y th\u00ec kh\u00f4ng c\u1ea7n d\u00f9ng CALCULATE:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Total Sales = SUM(Sales&#91;Amount])<\/code><\/pre>\n\n\n\n<p>CALCULATE ch\u1ec9 th\u1ef1c s\u1ef1 c\u1ea7n thi\u1ebft khi b\u1ea1n mu\u1ed1n:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Th\u00eam ho\u1eb7c thay \u0111\u1ed5i \u0111i\u1ec1u ki\u1ec7n l\u1ecdc<\/li>\n\n\n\n<li>Lo\u1ea1i b\u1ecf filter<\/li>\n\n\n\n<li>Th\u1ef1c hi\u1ec7n Time Intelligence<\/li>\n\n\n\n<li>T\u1ea1o c\u00e1c ph\u00e9p t\u00ednh \u0111\u1ed9ng ph\u1ee9c t\u1ea1p<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-vi-sao-k\u1ebft-qu\u1ea3-khi-dung-calculate-doi-khi-khong-gi\u1ed1ng-slicer\"><strong>V\u00ec sao k\u1ebft qu\u1ea3 khi d\u00f9ng <\/strong>CALCULATE<strong> \u0111\u00f4i khi \u201ckh\u00f4ng gi\u1ed1ng slicer\u201d?<\/strong><\/h3>\n\n\n\n<p>Nguy\u00ean nh\u00e2n th\u01b0\u1eddng l\u00e0 v\u00ec CALCULATE \u0111\u00e3:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ghi \u0111\u00e8 filter tr\u00ean c\u00f9ng m\u1ed9t c\u1ed9t<\/li>\n\n\n\n<li>Ho\u1eb7c lo\u1ea1i b\u1ecf filter b\u1eb1ng ALL\/REMOVEFILTERS<\/li>\n<\/ul>\n\n\n\n<p>\u0110i\u1ec1u n\u00e0y kh\u00f4ng ph\u1ea3i l\u1ed7i c\u1ee7a Power BI, m\u00e0 l\u00e0 do filter context \u0111\u00e3 b\u1ecb thay \u0111\u1ed5i theo logic c\u1ee7a measure.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-t\u1ed5ng-k\u1ebft\"><span class=\"ez-toc-section\" id=\"Tong_ket\"><\/span><strong>T\u1ed5ng k\u1ebft<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>CALCULATE kh\u00f4ng ch\u1ec9 l\u00e0 m\u1ed9t h\u00e0m b\u1ed5 sung \u0111i\u1ec1u ki\u1ec7n l\u1ecdc, m\u00e0 l\u00e0 c\u00f4ng c\u1ee5 gi\u00fap b\u1ea1n ki\u1ec3m so\u00e1t b\u1ed1i c\u1ea3nh t\u00ednh to\u00e1n trong DAX. T\u1eeb vi\u1ec7c th\u00eam filter, ghi \u0111\u00e8 filter, x\u00f3a filter cho \u0111\u1ebfn k\u1ebft h\u1ee3p v\u1edbi Time Intelligence, g\u1ea7n nh\u01b0 m\u1ecdi c\u00f4ng th\u1ee9c DAX n\u00e2ng cao \u0111\u1ec1u xoay quanh CALCULATE.&nbsp;<\/p>\n\n\n\n<p>Khi b\u1ea1n hi\u1ec3u r\u00f5 c\u00e1ch CALCULATE ho\u1ea1t \u0111\u1ed9ng v\u00e0 m\u1ed1i li\u00ean h\u1ec7 c\u1ee7a n\u00f3 v\u1edbi filter context, DAX s\u1ebd kh\u00f4ng c\u00f2n l\u00e0 t\u1eadp h\u1ee3p c\u00e1c c\u00f4ng th\u1ee9c kh\u00f3 nh\u1edb m\u00e0 tr\u1edf th\u00e0nh m\u1ed9t h\u1ec7 th\u1ed1ng logic c\u00f3 th\u1ec3 ki\u1ec3m so\u00e1t \u0111\u01b0\u1ee3c. \u0110\u00e2y c\u0169ng l\u00e0 b\u01b0\u1edbc chuy\u1ec3n quan tr\u1ecdng gi\u00fap b\u1ea1n \u0111i t\u1eeb m\u1ee9c \u201cbi\u1ebft vi\u1ebft measure\u201d sang m\u1ee9c \u201cth\u1ef1c s\u1ef1 l\u00e0m ch\u1ee7 Power BI\u201d th\u00f4ng qua vi\u1ec7c ki\u1ec3m so\u00e1t filter context m\u1ed9t c\u00e1ch ch\u1ee7 \u0111\u1ed9ng.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Trong h\u1ec7 sinh th\u00e1i DAX c\u1ee7a Power BI, h\u00e0m CALCULATE trong Power BI cho ph\u00e9p b\u1ea1n ki\u1ec3m so\u00e1t v\u00e0 thay \u0111\u1ed5i ng\u1eef c\u1ea3nh l\u1ecdc tr\u01b0\u1edbc khi th\u1ef1c hi\u1ec7n ph\u00e9p t\u00ednh \u0111\u00f3, can thi\u1ec7p s\u00e2u h\u01a1n c\u00e1c h\u00e0m t\u1ed5ng h\u1ee3p nh\u01b0 SUM hay AVERAGE. Ch\u00ednh kh\u1ea3 n\u0103ng n\u00e0y bi\u1ebfn h\u00e0m CALCULATE th\u00e0nh n\u1ec1n t\u1ea3ng c\u1ee7a h\u1ea7u [&hellip;]<\/p>\n","protected":false},"author":209,"featured_media":95615,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_gspb_post_css":"","footnotes":""},"categories":[109],"tags":[],"class_list":["post-95614","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chuyen-mon-it"],"blocksy_meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v27.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>H\u00e0m CALCULATE trong Power BI:\u00a0H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng k\u00e8m v\u00ed d\u1ee5 - ITviec Blog<\/title>\n<meta name=\"description\" content=\"T\u00ecm hi\u1ec3u chi ti\u1ebft h\u00e0m CALCULATE trong Power BI: c\u00e1ch ho\u1ea1t \u0111\u1ed9ng, thay \u0111\u1ed5i filter context, v\u00ed d\u1ee5, Time Intelligence v\u00e0 nh\u1eefng l\u1ed7i th\u01b0\u1eddng g\u1eb7p.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"H\u00e0m CALCULATE trong Power BI:\u00a0H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng k\u00e8m v\u00ed d\u1ee5\" \/>\n<meta property=\"og:description\" content=\"Trong h\u1ec7 sinh th\u00e1i DAX c\u1ee7a Power BI, h\u00e0m CALCULATE trong Power BI cho ph\u00e9p b\u1ea1n ki\u1ec3m so\u00e1t v\u00e0 thay \u0111\u1ed5i ng\u1eef c\u1ea3nh l\u1ecdc tr\u01b0\u1edbc khi th\u1ef1c hi\u1ec7n ph\u00e9p t\u00ednh \u0111\u00f3, can\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/\" \/>\n<meta property=\"og:site_name\" content=\"ITviec Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ITviec\" \/>\n<meta property=\"article:published_time\" content=\"2026-04-18T15:23:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-18T15:24:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2026\/04\/3-scaled.png\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"421\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"M\u1ef9 Duy\u00ean\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ITviec\" \/>\n<meta name=\"twitter:site\" content=\"@ITviec\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"M\u1ef9 Duy\u00ean\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 ph\u00fat\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"H\u00e0m CALCULATE trong Power BI:\u00a0H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng k\u00e8m v\u00ed d\u1ee5 - ITviec Blog","description":"T\u00ecm hi\u1ec3u chi ti\u1ebft h\u00e0m CALCULATE trong Power BI: c\u00e1ch ho\u1ea1t \u0111\u1ed9ng, thay \u0111\u1ed5i filter context, v\u00ed d\u1ee5, Time Intelligence v\u00e0 nh\u1eefng l\u1ed7i th\u01b0\u1eddng g\u1eb7p.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/","og_locale":"vi_VN","og_type":"article","og_title":"H\u00e0m CALCULATE trong Power BI:\u00a0H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng k\u00e8m v\u00ed d\u1ee5","og_description":"Trong h\u1ec7 sinh th\u00e1i DAX c\u1ee7a Power BI, h\u00e0m CALCULATE trong Power BI cho ph\u00e9p b\u1ea1n ki\u1ec3m so\u00e1t v\u00e0 thay \u0111\u1ed5i ng\u1eef c\u1ea3nh l\u1ecdc tr\u01b0\u1edbc khi th\u1ef1c hi\u1ec7n ph\u00e9p t\u00ednh \u0111\u00f3, can","og_url":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/","og_site_name":"ITviec Blog","article_publisher":"https:\/\/www.facebook.com\/ITviec","article_published_time":"2026-04-18T15:23:20+00:00","article_modified_time":"2026-04-18T15:24:40+00:00","og_image":[{"width":800,"height":421,"url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2026\/04\/3-scaled.png","type":"image\/png"}],"author":"M\u1ef9 Duy\u00ean","twitter_card":"summary_large_image","twitter_creator":"@ITviec","twitter_site":"@ITviec","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"M\u1ef9 Duy\u00ean","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"15 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#article","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/"},"author":{"name":"M\u1ef9 Duy\u00ean","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/73733c0725c7e39e696a896bd1abe2d7"},"headline":"H\u00e0m CALCULATE trong Power BI:\u00a0H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng k\u00e8m v\u00ed d\u1ee5","datePublished":"2026-04-18T15:23:20+00:00","dateModified":"2026-04-18T15:24:40+00:00","mainEntityOfPage":{"@id":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/"},"wordCount":3926,"publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"image":{"@id":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2026\/04\/3-scaled.png","articleSection":["Chuy\u00ean m\u00f4n IT"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/","url":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/","name":"H\u00e0m CALCULATE trong Power BI:\u00a0H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng k\u00e8m v\u00ed d\u1ee5 - ITviec Blog","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#primaryimage"},"image":{"@id":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2026\/04\/3-scaled.png","datePublished":"2026-04-18T15:23:20+00:00","dateModified":"2026-04-18T15:24:40+00:00","description":"T\u00ecm hi\u1ec3u chi ti\u1ebft h\u00e0m CALCULATE trong Power BI: c\u00e1ch ho\u1ea1t \u0111\u1ed9ng, thay \u0111\u1ed5i filter context, v\u00ed d\u1ee5, Time Intelligence v\u00e0 nh\u1eefng l\u1ed7i th\u01b0\u1eddng g\u1eb7p.","breadcrumb":{"@id":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#primaryimage","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2026\/04\/3-scaled.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2026\/04\/3-scaled.png","width":800,"height":421,"caption":"H\u00e0m calculate trong power bi - itviec blog"},{"@type":"BreadcrumbList","@id":"https:\/\/itviec.com\/blog\/ham-calculate-trong-power-bi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Chuy\u00ean m\u00f4n IT","item":"https:\/\/itviec.com\/blog\/chuyen-mon-it\/"},{"@type":"ListItem","position":2,"name":"H\u00e0m CALCULATE trong Power BI:\u00a0H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng k\u00e8m v\u00ed d\u1ee5"}]},{"@type":"WebSite","@id":"https:\/\/itviec.com\/blog\/#website","url":"https:\/\/itviec.com\/blog\/","name":"ITviec Blog","description":"IT Jobs &amp; People in Vietnam","publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itviec.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/itviec.com\/blog\/#organization","name":"ITviec","url":"https:\/\/itviec.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","width":1800,"height":1800,"caption":"ITviec"},"image":{"@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ITviec","https:\/\/x.com\/ITviec","https:\/\/www.linkedin.com\/company\/itviec","https:\/\/www.youtube.com\/channel\/UCYthAQ3bcGr57M_ag5gHDvQ"]},{"@type":"Person","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/73733c0725c7e39e696a896bd1abe2d7","name":"M\u1ef9 Duy\u00ean","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/Author_Duyen-Tran-120x120.jpg","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/Author_Duyen-Tran-120x120.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/Author_Duyen-Tran-120x120.jpg","caption":"M\u1ef9 Duy\u00ean"},"url":"https:\/\/itviec.com\/blog\/author\/my-duyen\/"}]}},"_links":{"self":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/95614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/users\/209"}],"replies":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/comments?post=95614"}],"version-history":[{"count":4,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/95614\/revisions"}],"predecessor-version":[{"id":95694,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/95614\/revisions\/95694"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media\/95615"}],"wp:attachment":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media?parent=95614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/categories?post=95614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/tags?post=95614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}