Forum Discussion

preeti9392's avatar
preeti9392
Frequent Visitor
1 year ago
Solved

Line graph showing one point with userelationship

<p>&lt;/p&gt;In my dataset, I have one column containing months, another column containing quarters, and where month is present, quarter is empty, and where quarter is present, month is empty, and one more column having KPI values. So for each month, KPI value is present, and for each quarter, KPI value is present. And I have created a relationship with the date table using month column from my dataset. And for one line graph, I want to use the relationship of quarter. How I can do that? While using the use relationship, when I am trying to plot it, I am getting only one point.&lt;/p&gt;</p>

  • preeti9392's avatar
    preeti9392
    1 year ago

    Hello Yes I normalised the column containing months and quarters for kpi values it worked fine but not for target values. so i used the constant line for the targets.

8 Replies

  • Shahid12523's avatar
    Shahid12523
    Icon for Community Champion rankCommunity Champion

    Create a measure using USERELATIONSHIP:

     

    KPI by Quarter =
    CALCULATE(
    SUM(FactTable[KPI Value]),
    USERELATIONSHIP(FactTable[Quarter], DateTable[Quarter])
    )


    Use DateTable[Quarter] on the axis and this measure as values in your line chart.

    This plots KPI per quarter correctly.

  • preeti9392's avatar
    preeti9392
    Frequent Visitor

    Thanks for your answer. The problem is that i tried, but it is giving me only one point. not the point or line according to time (x axis)... Maybe because i am plotting other KPI values one the same visusal according to months also(I am not sure). Is it possible to use two relationships in the same visual.

  • Hi preeti9392 

    In your model, you have a dataset where KPI values exist at both the month and quarter levels, but only one of the two columns (month or quarter) is populated per row. Since you’ve created a relationship to the Date table using the month column, your visuals naturally work at the monthly grain. However, when you try to switch to quarters using USERELATIONSHIP, you only see a single point because Power BI is evaluating against rows where only the quarter column is populated, and the relationship to the Date table isn’t active at the same time as the month one. The best practice here is to normalize your data: instead of having separate month and quarter columns with mutually exclusive values, restructure the dataset so there is a single DateKey (linked to your Date table) and a flag or column indicating whether the row is at the month or quarter level. This way, both KPIs share the same relationship path, and you can build a line chart by month or by quarter without needing USERELATIONSHIP. If restructuring isn’t possible, then you may need two separate fact tables (one for monthly KPIs, one for quarterly KPIs) each connected to the Date table on the correct column, and use them in separate visuals or combine them with a calculation group to switch granularity.

     

  • v-echaithra's avatar
    v-echaithra
    Icon for Community Support rankCommunity Support

    Hi preeti9392 ,

    Thank you for your contibution Poojara_D12 .

    May I ask if you have resolved this issue? Please let us know if you have any further issues, we are happy to help.

    Thank you.

  • v-echaithra's avatar
    v-echaithra
    Icon for Community Support rankCommunity Support

    Hi preeti9392 ,

    We’d like to follow up regarding the recent concern. Kindly confirm whether the issue has been resolved, or if further assistance is still required, please provide me a sample data. We are available to support you and are committed to helping you reach a resolution.

    Best Regards,
    Chaithra E.

    • preeti9392's avatar
      preeti9392
      Frequent Visitor

      Hello Yes I normalised the column containing months and quarters for kpi values it worked fine but not for target values. so i used the constant line for the targets.

  • v-echaithra's avatar
    v-echaithra
    Icon for Community Support rankCommunity Support

    Hi preeti9392 ,

    Thank you for the update.

    Could you please confirm if the issue has been resolved on your end? If so, we’ll proceed with closing the thread from our side.

    If you encounter any further issues, feel free to reach out, we’re happy to assist.

    Thank you!