+ Reply to Thread
Results 1 to 5 of 5

DAX Measure to Count rows that have in date table that match dates in fact table.

  1. #1
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    768

    DAX Measure to Count rows that have in date table that match dates in fact table.

    I would like to count the number of month in a Year / Month Pivot table that have sales,

    so if all months have sales = 12 etc.

    I have managed to do this by using the date column and the built in hierarchy in the fact table ;

    Please Login or Register  to view this content.
    and then ;

    Please Login or Register  to view this content.
    Which works, surprisingly, when used in a pivot table using the Calendar / date table years and months.


    Is there way to get this result with creating all the extra columns in the sales / fact table as these only existed creating the pivot using the date hierarchy.

    I've attached both showing both using Dates from date table and dates from fact table.

    Richard.
    Attached Files Attached Files

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,966

    Re: DAX Measure to Count rows that have in date table that match dates in fact table.

    Similar to your last post:

    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    768

    Re: DAX Measure to Count rows that have in date table that match dates in fact table.

    I just get an error ; syntax incorrect ;

    Please Login or Register  to view this content.
    I don't have a month column in Table1 , just dates, I had them in the upload as they were created along with the first pivot,
    but that's what I'm trying to avoid.
    I thought I might be able to filter the Calendar table to just the dates in the Table1 Date column

    Please Login or Register  to view this content.
    But this does not work.

    RD

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,966

    Re: DAX Measure to Count rows that have in date table that match dates in fact table.

    You can use:

    =if(isblank([Tunits]),blank(),COUNTX(ALL('Calendar'[Month]),[Tunits]))

    as long as you use the date fields from the calendar table in the pivot.

  5. #5
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    768

    Re: DAX Measure to Count rows that have in date table that match dates in fact table.

    Thanks, works a treat, I was along the right lines earlier but I don't think I'd used the BLANK() , I'd give you a rep but I it won't let me,

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. DAX Filter fact table by Dates on dim table
    By Dicken in forum Office 365
    Replies: 1
    Last Post: 02-02-2023, 12:42 PM
  2. Using distinct count measure in Pivot table
    By HR85 in forum Excel General
    Replies: 1
    Last Post: 03-16-2022, 05:30 PM
  3. Pivot Table: Grand Total different measure from Column measure
    By chinneywow in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 08-07-2019, 06:22 AM
  4. Replies: 4
    Last Post: 06-20-2019, 03:04 PM
  5. [SOLVED] Match a date from a Table of dates, Help Please.
    By john dalton in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-05-2015, 08:48 AM
  6. Countifs to count rows with a date which match a range of dates
    By pharmerjoe7 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-07-2013, 06:19 AM
  7. Replies: 1
    Last Post: 11-29-2011, 10:52 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1