How to create measure table in Power BI

이미지
   # Power BI - How to create measure table How to Create a Measures Table We're gonna dive into how to create a Measures Table in Power BI. It's super helpful for managing all your measures efficiently. A Measures Table is a best practice that seriously boosts your report's readability and makes it way easier to maintain . 1.  Why Create a Measures Table? Here's the problem: As you build out your Power BI model, all your measures (the stuff you calculate with DAX) tend to get spread out among a bunch of different tables. What happens then? Well, it takes forever to find the right measure in the Fields pane when you're building a report, and the whole model becomes a nightmare to manage later on. The Measures Table is the fix! It's basically a special container that holds only your measures. This keeps them clean, organized, and visible right at the top of your field list, easy to spot with the little calculator icon. 2.  The Core Steps: How to Create...

Power BI DAX – CALCULATE 함수로 조건별 데이터 집계하기

 # Power BI DAX – Calculation amount of Kakao Pay using the Caltulate Funtion

 

안녕하세요!

Power BI에서 특정 조건에 맞는 데이터만 계산하고 싶을 때 CALCULATE 함수를 사용하면 매우 편리합니다.

예를 들어,

  • 결제 수단이 Kakao Pay이고

  • 도시가 Seoul인 거래만 합계, 건수, 매출 등을 계산하고 싶다면?

이때 바로 CALCULATE 함수가 쓰입니다.


1. CALCULATE 함수란?

CALCULATE조건(Filter)을 적용하여 값(Value)을 계산하는 함수입니다.
기본 문법:

CALCULATE(<수식>, <필터1>, <필터2>, ...)
  • <수식>: 계산할 값 (예: SUM, COUNTROWS)

  • <필터>: 조건 (예: [Payment] = "Kakao Pay")


2. 예제: Kakao Pay 결제 중, 서울(City=Seoul) 거래만 카운트

Kakao_Seoul(Count) =
CALCULATE(COUNTROWS()
    , d_Payment[Payment] = "Kakao Pay"
    , f_Sales[City] = "Seoul"
)


New Measure_How to use Calculate funtion to get result of payment & City filtering

 f_Sales 테이블에서 조건 필터를 걸고
그 조건을 만족하는 행 수(COUNTROWS)를 계산합니다.
Payment가 "Kakao Pay" 이면서 City가 "Seoul"인 경우만 결과에 포함됩니다.
 
 Tip >> 참고로, 하기 그림과 같이 Payment의 경우 d_Payment 테이블에 모델링이 되어있기 때문에, f_Sales 테이블과 분리되어 있더라도 필터를 걸어 사용할 수 있습니다. 이게 바로 Power BI의 장점이라고 할 수 있습니다.

d_Payment table has [Payment] column. and it is modeling with f_sales table [Payment].

     결과는???  


resulft with calcuoate funtion is "1"
1 건으로 보입니다. 

f_Sales에 가서 Payment code "B01" 에 해당하고, City 가 "Seoul" 인 경우를 확인 해 보겠습니다.


double check in f_sales table with condition as calculated  (Kakao pay & Seoul)

위 처럼 해당되는 Row 수는 1건 인 것이 확인 됩니다.
 


3. 추가 응용

  1. SUM 사용 예제 – 조건에 맞는 매출 합계

Kakao_Seoul(Count) = CALCULATE( SUM(f_Sales[Amount]), f_Sales[PaymentMethod] = "Kakao Pay", f_Sales[City] = "Seoul" )
  1. 다중 조건 – AND, OR 적용 가능

CALCULATE( COUNTROWS(f_Sales, d_Payment[Payment] = "Kakao Pay" && Transactions[City] = "Seoul" )

>> 여기서 And 조건을 넣을 때, DAX 에서는 && 으로 사용합니다!

5. TIP

  • CALCULATE 안에서는 여러 조건(Filter) 적용 가능

  • 열(Column)뿐 아니라 Measure로도 조건 적용 가능

  • 필터링이 많아지면 FILTER 함수를 중첩하여 세밀하게 적용 가능

CALCULATE( SUM(f_Sales[Amount]),
FILTER(d_Payment, d_Pament[PaymentMethod] =
"Kakao Pay" && Transactions[City] = "Seoul") )

>> Filter를 사용할 때는, 테이블명, 테이블명[컬럼명] 규칙으로 써주셔야 해요.


마무리

조건함수 예시
Kakao Pay + Seoul 건수CALCULATE(COUNTROWS(), 조건1, 조건2)
Kakao Pay + Seoul 매출 합계CALCULATE(SUM(Amount), 조건1, 조건2)
세밀한 조건CALCULATE(SUM(Amount), FILTER(...))


오늘 Calculate 함수에 대해 알아보았는데요. 마지막에 다룬 Filter 함수 의 경우 여러 종류가 있고, 사용법도 다릅니다.  다음번에 Filter 함수에 대해서도 알아보도록 할게요!


<이 블로그 내 다른 게시글>






인기글

Power BI Desktop 무료버전 설치방법 (2025년 9월 최신 가이드)

Power BI DAX – SWITCH 함수로 영어 카테고리를 한글로 바꾸기

Power BI DAX 기초부터! 데이터 분석의 첫걸음