Forum Discussion

AllanBerces's avatar
AllanBerces
Post Prodigy
4 months ago
Solved

Count base from other column

Hi good day can anyone help me on my measure, i have table and i want to count the number in phase 2 base from phase 1. Sample on my table Phase 1  month of March total count is 27 and phase for the month of March total count is 21

JobPhase1Phase2
erywt3/2/20263/3/2026
rhrth3/16/20263/16/2026
he3/30/20264/7/2026
rtehr3/10/20263/11/2026
jkyu3/11/20263/12/2026
k,y,3/17/20263/29/2026
g,hj,3/18/20263/31/2026
uujtyjh3/21/20263/27/2026
hstrh3/28/20263/31/2026
rth3/2/20263/11/2026
srthr3/6/20263/11/2026
shtu563/7/20263/10/2026
uj3/7/20263/16/2026
srthr3/8/20263/10/2026
eu3/9/20263/16/2026
j6eu3/10/20263/16/2026
eju3/14/20263/18/2026
srthr3/14/20263/16/2026
fghs3/19/20263/19/2026
wht56u3/18/20263/30/2026
e63/27/20264/2/2026
ash3/27/20264/6/2026
shtsh3/31/20264/11/2026
ytjt763/31/20264/11/2026
e5u5e3/13/20263/16/2026
eu6sj3/22/20264/7/2026
srhtr3/17/20263/19/2026
  • Hi,

    Thank you for sharing your data! Based on your requirement, you need to count the number of records per month separately for Phase1 and Phase2 columns. Here are the DAX measures to achieve this:

    **Step 1 Create a Month column (if not already present):**
    '''
    Month = FORMAT('YourTable'[Phase1], "MMM")
    '''

    **Step 2 — Measure to count Phase1 by month:**
    '''
    Phase1 Count =
    COUNTROWS(
    FILTER(
    'YourTable',
    MONTH('YourTable'[Phase1]) = MONTH(MIN('YourTable'[Phase1]))
    )
    )
    '''

    **Step 3 Measure to count Phase2 by month:**
    '''
    Phase2 Count =
    COUNTROWS(
    FILTER(
    'YourTable',
    MONTH('YourTable'[Phase2]) = MONTH(MIN('YourTable'[Phase1]))
    )
    )
    '''

    **Recommended Approach Using a Date/Month slicer or Matrix visual:**

    Place these measures in a **Matrix visual** with Month on rows:
    '''
    Phase1 Count =
    CALCULATETABLE(
    COUNTROWS('YourTable'),
    MONTH('YourTable'[Phase1]) = SELECTEDVALUE('MonthTable'[MonthNumber])
    )
    '''

    **Simplest working measure using FORMAT:**
    '''
    Phase1 Count =
    COUNTROWS(
    FILTER(
    'YourTable',
    FORMAT('YourTable'[Phase1], "MMM") = SELECTEDVALUE('YourTable'[Month])
    )
    )

    Phase2 Count =
    COUNTROWS(
    FILTER(
    'YourTable',
    FORMAT('YourTable'[Phase2], "MMM") = SELECTEDVALUE('YourTable'[Month])
    )
    )
    '''

    This will give you the exact output shown in your sample table where March shows *27 for Phase1* and *21 for Phase2*.

    Hope this helps! Let us know if you need further clarification. Please consdier this as accepted solution if helpful.

4 Replies

  • Hi,

    Thank you for sharing your data! Based on your requirement, you need to count the number of records per month separately for Phase1 and Phase2 columns. Here are the DAX measures to achieve this:

    **Step 1 Create a Month column (if not already present):**
    '''
    Month = FORMAT('YourTable'[Phase1], "MMM")
    '''

    **Step 2 — Measure to count Phase1 by month:**
    '''
    Phase1 Count =
    COUNTROWS(
    FILTER(
    'YourTable',
    MONTH('YourTable'[Phase1]) = MONTH(MIN('YourTable'[Phase1]))
    )
    )
    '''

    **Step 3 Measure to count Phase2 by month:**
    '''
    Phase2 Count =
    COUNTROWS(
    FILTER(
    'YourTable',
    MONTH('YourTable'[Phase2]) = MONTH(MIN('YourTable'[Phase1]))
    )
    )
    '''

    **Recommended Approach Using a Date/Month slicer or Matrix visual:**

    Place these measures in a **Matrix visual** with Month on rows:
    '''
    Phase1 Count =
    CALCULATETABLE(
    COUNTROWS('YourTable'),
    MONTH('YourTable'[Phase1]) = SELECTEDVALUE('MonthTable'[MonthNumber])
    )
    '''

    **Simplest working measure using FORMAT:**
    '''
    Phase1 Count =
    COUNTROWS(
    FILTER(
    'YourTable',
    FORMAT('YourTable'[Phase1], "MMM") = SELECTEDVALUE('YourTable'[Month])
    )
    )

    Phase2 Count =
    COUNTROWS(
    FILTER(
    'YourTable',
    FORMAT('YourTable'[Phase2], "MMM") = SELECTEDVALUE('YourTable'[Month])
    )
    )
    '''

    This will give you the exact output shown in your sample table where March shows *27 for Phase1* and *21 for Phase2*.

    Hope this helps! Let us know if you need further clarification. Please consdier this as accepted solution if helpful.

  • For your reference.

     

    Step 1: I make a 'Calendar' table and add two relationships.

        Calendar = CALENDARAUTO()

     

     

    Step 2: I make a 'Measure' and a matrix below.

        M_Count_Ph2 = CALCULATE(COUNT(DATA[Phase2]),USERELATIONSHIP('Calendar'[Date],DATA[Phase2]))