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
galavichid
New Member

Create line chart based on data from measures

Hi,

I am trying to save time on copy data from Power BI to PP by creating this line chart:

galavichid_0-1704144427304.png

Each dot, present BWH % calculated by a measure based on another measure which calculated data from excel sheets:

 

BWH SBN-C1 =
VAR Total_Hours =
    SUMX(
        'SBN-C1',
        HOUR('SBN-C1'[TotalTime]) + DIVIDE(MINUTE('SBN-C1'[TotalTime]),60) + DIVIDE(SECOND('SBN-C1'[TotalTime]),3600)
    )
VAR DaysTotal = DIVIDE(Total_Hours,24)
VAR HoursTotal = (DaysTotal)*24
VAR HoursInt = TRUNC(HoursTotal)
VAR MinutesTotal = (HoursTotal - HoursInt)*60
VAR MinutesInt = TRUNC(MinutesTotal)
VAR SecondsTotal = ROUND((MinutesTotal - MinutesInt)*60,0)
RETURN
    DIVIDE(Total_Hours, 576)

 

 

The solution i am looking for, is how to show the BWH of all sites, of the same month + the month before.

If i slice let say September, Ill get the BWH from each site of the month of September, and another line of August.

Any suggestion will be welcome 🙂

 

Thanks!

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @galavichid ,

 

According to your description, here are my steps you can follow as a solution.

(1) We can create a Date Table.

DateTable = ADDCOLUMNS(CALENDAR(DATE(2023,1,1),DATE(2023,12,31)),"year",YEAR([Date]),"month",MONTH([Date]))

vtangjiemsft_0-1704160411760.png

(2) We can create a measure. 

BWH Previous Month = 
   CALCULATE(
       [BWH %],
       DATEADD('DateTable'[Date], -1, MONTH)
   )

(3) Then the result is as follows.

vtangjiemsft_1-1704161233489.pngvtangjiemsft_2-1704161280802.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

1 REPLY 1
v-tangjie-msft
Community Support
Community Support

Hi @galavichid ,

 

According to your description, here are my steps you can follow as a solution.

(1) We can create a Date Table.

DateTable = ADDCOLUMNS(CALENDAR(DATE(2023,1,1),DATE(2023,12,31)),"year",YEAR([Date]),"month",MONTH([Date]))

vtangjiemsft_0-1704160411760.png

(2) We can create a measure. 

BWH Previous Month = 
   CALCULATE(
       [BWH %],
       DATEADD('DateTable'[Date], -1, MONTH)
   )

(3) Then the result is as follows.

vtangjiemsft_1-1704161233489.pngvtangjiemsft_2-1704161280802.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

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.