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
DodSmith
Regular Visitor

Newbie to Power BI with challenging data problem

I am new to Power BI. I understand the principles and have been playing with the data. Looks mostly straightforward  to use. I however have a challenge I hope that someone can help me. with
 
I have a dataset of logged data. The data consists of a set of variable names (VarName) with a Variable value(VarValue) and a timestamp (tiimestring) of when the value was captured. See a selection of the data below.
 
I want to take an average of the values for each variable at every timestamp (more than one value for one timestamp). Then I want to produce a line graph with lines for each variable with the timestamping as the x axis and value as the y axis.
 
This would be a basis for a data logger function I want to implement later where Ideally I want to go si to build a vertical logger with window with the variable names at the top and timestamping on the left and the values along the bottom. But this will come later.
I would appreciate any help on this.
 
Best regards GGS

 

VarNameTimeStringVarValue
API_600rpm19.07.2019 08:2373.56052
API_300rpm19.07.2019 08:2343.72612
API_200rpm19.07.2019 08:2333.54956
API_100rpm19.07.2019 08:2323.51505
API_6rpm19.07.2019 08:237.696274
API_3rpm19.07.2019 08:237.448882
API_600rpm19.07.2019 08:2373.41819
API_300rpm19.07.2019 08:2343.62548
API_200rpm19.07.2019 08:2333.47369
API_100rpm19.07.2019 08:2323.46848
API_6rpm19.07.2019 08:237.691678
API_3rpm19.07.2019 08:237.443955
API_600rpm19.07.2019 08:2373.29433
API_300rpm19.07.2019 08:2343.55198
API_200rpm19.07.2019 08:2333.42208
API_100rpm19.07.2019 08:2323.43895
API_6rpm19.07.2019 08:237.68972
API_3rpm19.07.2019 08:237.441484
API_600rpm19.07.2019 08:2473.2063
API_300rpm19.07.2019 08:2443.16627
API_200rpm19.07.2019 08:2433.05322
API_100rpm19.07.2019 08:2423.15962
API_6rpm19.07.2019 08:247.679123
API_3rpm19.07.2019 08:247.427405
API_600rpm19.07.2019 08:2473.26457
API_300rpm19.07.2019 08:2443.14558
API_200rpm19.07.2019 08:2433.02204
API_100rpm19.07.2019 08:2423.1307
API_6rpm19.07.2019 08:247.67869
API_3rpm19.07.2019 08:247.427323
API_600rpm19.07.2019 08:2473.32072
API_300rpm19.07.2019 08:2443.13333
API_200rpm19.07.2019 08:2432.99954
API_100rpm19.07.2019 08:2423.1089
API_6rpm19.07.2019 08:247.678564
API_3rpm19.07.2019 08:247.427793
API_600rpm19.07.2019 08:2473.36995
API_300rpm19.07.2019 08:2443.12649
API_200rpm19.07.2019 08:2432.98364
API_100rpm19.07.2019 08:2423.09279
API_6rpm19.07.2019 08:247.678606
API_3rpm19.07.2019 08:247.42849
API_600rpm19.07.2019 08:2472.32797
API_300rpm19.07.2019 08:2442.88657
API_200rpm19.07.2019 08:2432.9267
API_100rpm19.07.2019 08:2423.17574
API_6rpm19.07.2019 08:247.697506
API_3rpm19.07.2019 08:247.461083
API_600rpm19.07.2019 08:2572.3369
API_300rpm19.07.2019 08:2542.90461
API_200rpm19.07.2019 08:2532.94062
API_100rpm19.07.2019 08:2523.18999
API_6rpm19.07.2019 08:257.701194
API_3rpm19.07.2019 08:257.469333
API_600rpm19.07.2019 08:2572.3615
API_300rpm19.07.2019 08:2542.92539
API_200rpm19.07.2019 08:2532.95452
API_100rpm19.07.2019 08:2523.20271
API_6rpm19.07.2019 08:257.704765
API_3rpm19.07.2019 08:257.477392
API_600rpm19.07.2019 08:2572.40051
API_300rpm19.07.2019 08:2542.9482
API_200rpm19.07.2019 08:2532.96788
API_100rpm19.07.2019 08:2523.21349
API_6rpm19.07.2019 08:257.708211
API_3rpm19.07.2019 08:257.485224
API_600rpm19.07.2019 08:2572.45141
API_300rpm19.07.2019 08:2542.973
API_200rpm19.07.2019 08:2532.98118
API_100rpm19.07.2019 08:2523.22311
API_6rpm19.07.2019 08:257.711555
API_3rpm19.07.2019 08:257.49289
1 ACCEPTED SOLUTION

On the table name, no. My sample data was just called Table. If yours is called Sales, then your measure would be Sales[Field Names], or 'Inventory Values'[Some Filed Name]

 

Table names generally are in single quotes, and field names are always in square brackets.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

7 REPLIES 7
edhans
Super User
Super User

See if this is what you need @DodSmith 

Average Value =
VAR CurrentVariable =
    MAX( 'Table'[VarName] )
VAR CurrentTimeStamp =
    MAX( 'Table'[TimeString] )
VAR AverageValue =
    AVERAGEX(
        FILTER(
            ALL( 'Table' ),
            'Table'[VarName] = CurrentVariable
                && 'Table'[TimeString] = CurrentTimeStamp
        ),
        'Table'[VarValue]
    )
RETURN
    AverageValue

It returns this:

2020-05-20 10_51_05-Untitled - Power BI Desktop.png

 

My PBIX file is here if you want to see it.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
harshnathani
Community Champion
Community Champion

Hi @DodSmith ,

 

 

Use the measure =

 

 

Measure = CALCULATE (AVERAGE ('Table'[VarValue]), ALLEXCEPT('Table', 'Table'[VarName], 'Table'[TimeString])

 

 

1.jpg

 

 

Regards,

Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!!

Hi, where do you applyt the formula that you made and how?

 

Best Regards

@DodSmith it is a measure. See the PBIX file I linked to. A measure just goes wherever. Right-click on a table and select New Measure, but measures don't care what table they are in. I create "measure tables" to put them in and keep them out of my actual tables. 

 

Then just drop the measure into the Values section of the chart.

 

You don't want to generally create a new column, called a calculated column, in Power BI. That is something Excel users (like myself) immediately gravitate towards. But calcualted columsn are not efficient and should be avoided for most things.

 

In general, try to avoid calculated columns. There are times to use them, but it is rare. Getting data out of the source system, creating columns in Power Query, or DAX Measures are usually preferred to calculated columns. See these references:
Calculated Columns vs Measures in DAX
Calculated Columns and Measures in DAX
Storage differences between calculated columns and calculated tables
Creating a Dynamic Date Table in Power Query



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Hi @DodSmith ,

 

You will need to create a new measure.

 

Right Click the table in the Field's Section, you will see an option 'New Meaure'. This is also avaiable in the Ribbon above.

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Hi again,

 

OK I had figured that out but when I put the DAX formula in place, I get an error that says cannot find table *Table'. Do I have to name the table of data I have first to be 'TAble'?

On the table name, no. My sample data was just called Table. If yours is called Sales, then your measure would be Sales[Field Names], or 'Inventory Values'[Some Filed Name]

 

Table names generally are in single quotes, and field names are always in square brackets.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.