Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Show Sent and Target Dates in one Chart

Hi All,

 

In my source Excel spreadsheet I have a number of 34 items ("ID") which have the "Study Sent to Customer Actual

(Year-Month)" and "Study Sent to Customer Target (Year-Month)" associated fields.

 

I would like to create in Power BI a Clustered Column Chart correctly containing these "ID" items versus both the

"Study Sent to Customer Actual (Year-Month)" and "Study Sent to Customer Target (Year-Month)" fields with the

correct values as shown in the graph that I was able to produce in Excel (see below).

 

IDStudy Sent to Customer Actual (Year-Month)Study Sent to Customer Target (Year-Month)
9802342018-122019-01
9802332019-012019-01
9802322019-012019-01
9803832018-122019-01
9804852019-012019-03
9805072019-022019-02
DQ-59442019-012019-01
9804952019-022019-01
9804932019-022019-03
980514 2019-03
9805152019-032019-02
9805172019-032019-03
980519 2019-04
DQ-59652018-122019-02
9805752019-012019-02
9805692019-022019-02
9805742019-032019-02
9805502019-042019-03
9805592019-022019-03
9805732019-032019-02
9807082019-032019-04
9807662019-052019-05
980682 2019-03
9807302019-022019-04
9807752019-042019-04
980694 2019-05
9806982019-052019-05
9807482019-032019-05
9807292019-062019-05
9807092019-052019-06
9807012019-042019-03
DQ-59922019-062019-06
9809392019-052019-06
9810242019-062019-06

 

ID(All)
  
Row LabelsCount of Study Sent to Customer Actual (Year-Month)
 4
2018-123
2019-015
2019-026
2019-036
2019-043
2019-054
2019-063
Grand Total34

 

ID(All)
  
Row LabelsCount of Study Sent to Customer Target (Year-Month)
2019-016
2019-027
2019-038
2019-044
2019-055
2019-064
Grand Total34

 

Year-MonthCount of Study Sent to Customer Actual (Year-Month)Count of Study Sent to Customer Target (Year-Month)
2018-1230
2019-0156
2019-0267
2019-0368
2019-0434
2019-0545
2019-0634

 

image 01.jpg

 

image 05.jpg

 

When I try to put together these "ID" items versus both "Study Sent to Customer Actual (Year-Month)" and "Study

Sent to Customer Target (Year-Month)" fields the Clustered Column Chart in Power BI only gets correct numbers for

one of the series "Study Sent to Customer Target (Year-Month)" but not for the other one ("Study Sent to Customer

Actual (Year-Month)").

 

image 03.jpg

 

However, when I create in Power BI separate Clustered Column Charts for "ID" items versus "Study Sent to Customer

Actual (Year-Month)" and for "ID" items versus "Study Sent to Customer Target (Year-Month)" fields, each one of

the two separate Power BI separate Clustered Column Charts shows correct values.

 

image 02a.jpg

 

image 02b.jpg

 

 

image 04.jpg

 

I have attached in the links provided below the Excel source file (Study Progress.xlsx) and the Power BI file

(Study Progress Report.pbix).


I would reaaly appreciate it if someone could explain me how could I achieve to create a Clustered Column Charts

for "ID" items versus the "Study Sent to Customer Actual (Year-Month)" and the "Study Sent to Customer Target

(Year-Month)" fields, showing the correct values.  In addition to an explanation, it would be great if you could

implement the worked solution in the provided Power BI file (Study Progress Report.pbix).

 

Thank you very much.

 

 

 

Excel source file (Study Progress.xlsx):

 

https://drive.google.com/open?id=1EgUHYetPX1ehgU7wKrULn12NDlBCzp0k

 


Power BI file (Study Progress Report.pbix):

https://drive.google.com/open?id=1B374ZKSQ7YNdpXlTCtAYH8Fqr8Ra7wtF

 

 

3 REPLIES 3

3 things.

 

1. Timing is everything.  I saw this exactly as I was put on hold for a phone call - still waiting.

2. you asked nicely and had a well laid out question - good job

3. Here is my part solution.  You should be able to work it out from here.  https://www.dropbox.com/s/3juvjgvb4uvt8av/Study%20Progress%20Report%20Matt.pbix?dl=1

 

Read here https://exceleratorbi.com.au/multiple-relationships-between-tables-in-dax/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Anonymous
Not applicable

Thank you so much Matt, very much appreciated.  Your approach uses some concepts which at this stage I am not quite familiar in Power BI.  I will review and try to better understand them.

 

I have a couple of questions:

 

1) If I understood correctly, your approach consists in creating a Calendar table and linking the Date field in the Calendar table to the Study Sent to Customer Actual field in the Progress_Data table (active relationship), as well as also linking the Date field in the Calendar table to the Study Sent to Customer Target field in the Progress_Data table (passive relationship) and doing the trick though creating 2 measures: Actual = COUNTROWS(Progress_Data), and Planned = CALCULATE(COUNTROWS(Progress_Data),USERELATIONSHIP('Calendar'[Date],Progress_Data[Study Sent to Customer Target])) , using the USERELATIONSHIP DAX Power BI function, which allows make a relationship active (even if that relationship is inactive, I hope I am expressing myself clearly and this makes sense!).  Question 1: Instead of making the relationship with Study Sent to Customer Actual active, having an Actual measure, and then forcing the relationship with Study Sent to Customer Target to be active active in the Planned mesure, in that order, could I also have done it the other way around (first Target and then Actual) with the same results?

 

image 10.jpg

 

 

image 11.jpg

 


2) Following up with my question to actually reflect my real life scenario, I should mention that I actually presented a succint simplified version of my issue.  However, in reality I have a source spreadsheet which in addition to the before described fields (Study Sent to Customer Actual, Study Sent to Customer Target) it also has other pairs of Actual and Target fields (Plan Version 1 Sent to Project Manager Actual / Plan Version 1 Sent to Project Manager Target , Plan Version 2 Sent to Project Manager Actual / Plan Version 2 Sent to Project Manager Target, Plan Version 3 Sent to Project Manager Actual / Plan Version 3 Sent to Project Manager Target, etc.) which I would also like to graph in a similar fasion (Plan Version 1 Sent to Project Manager Actual and Plan Version 1 Sent to Project Manager Target in a single Clustered Column Chart, Plan Version 2 Sent to Project Manager Actual and Plan Version 2 Sent to Project Manager Target in another single Clustered Column Chart, etc.).  Question 2: Would I need to create separates Calendar tables for each pair of Actual and Target fields, or could all of them use the same Calendar table?


Thanks again Matt.


JohnT1000

Hey @Anonymous ,

 

basically there is no better solution than the one considered by @MattAllington meaning it's essential to create a dedicated calendar table.

 

Regarding your question if it does matter which relation is active and which is inactive: no this does not matter. From my understanding I would make the target one active, as there are empty value for some surveys that have not been sent to. I tend to make that relationship active that is able to answer the most questions regarding, but of course this is also in a way some kind of esoterical thinking.

 

Another approach could also be create a slightly different model. I call the table that you presented a wide table. A different approach is to create a long table. I used the following DAX statement

 

Progress Data Long = 
UNION(
    SELECTCOLUMNS(
        FILTER(
            GENERATEALL(
                    SUMMARIZECOLUMNS(
                        'Progress_Data'[ID]
                        , 'Progress_Data'[Study Sent to Customer Actual]
                    )
                    , ROW("Type", "Actual")
            )
            ,NOT(ISBLANK('Progress_Data'[Study Sent to Customer Actual]))
        )
        , "Study ID" , [ID]
        , "Date" , [Study Sent to Customer Actual]
        , "Typye" , [Type]
    )
    ,
    FILTER(
        GENERATEALL( 
            SUMMARIZECOLUMNS(
                'Progress_Data'[ID]
                , 'Progress_Data'[Study Sent to Customer Target]
            )
            , ROW("Type" , "Target")
        )
        , NOT(ISBLANK('Progress_Data'[Study Sent to Customer Target]))
    )
)

to create this table (just a fraction):

 

image.png

I used DAX to create the table above as I was in a hurry. Basically I would recommend to use Power Query to shape the data model 🙂 

This avoids empty values, and then I create a visual like this without any measure:

image.png

 

Personally, I tend to solve my reporting requirements without writing DAX (of course most of the time this does not word, and I also have to admit that I love writing DAX), but I always recommend to think about the data model first. Due to it's power DAX is able to compensate for a "bad" data model, but this will haunt you sooner or later.

 

It's difficult to recommend a final solution, besides "you need a separate Calendar table", as I do not fully understand the description of the data from your second post.

 

Hopefully this will add some additional insights.

 

Regards,

Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.