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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
timEalll
Regular Visitor

Work around multiple datatypes calculation in Power BI

I am new to power bi.

Please below table:

timEalll_1-1682416156037.png

my data model relationship is datetable is linked with the above table by Date.
I want to create a line chart base on the Actual column. However, there are different datatype.

How can I achieve this for example, 
when i click on units "No", the chart should shiw line chart base on unit "No" on y-axis and date on the x-axis. the same applies to units "date" but with units "Text" is should be blank 

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

Hi , @timEalll 

According to your description, you want to "when i click on units "No", the chart should shiw line chart base on unit "No" on y-axis and date on the x-axis. the same applies to units "date" but with units "Text" is should be blank".

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_1-1682565893448.png

(2)We can create a measure like this:

Measure = var _slicer = SELECTEDVALUE('Table'[Units])
return
IF(_slicer ="Text", BLANK() , IF( _slicer ="date" , COUNTROWS('Table') , SUMX('Table' , VALUE('Table'[Actual]))))

 

Then we can put the measure on the visual and the result is as follows:

vyueyunzhmsft_2-1682565930682.png

 

vyueyunzhmsft_3-1682565945195.png

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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-yueyunzh-msft
Community Support
Community Support

Hi , @timEalll 

According to your description, you want to "when i click on units "No", the chart should shiw line chart base on unit "No" on y-axis and date on the x-axis. the same applies to units "date" but with units "Text" is should be blank".

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_1-1682565893448.png

(2)We can create a measure like this:

Measure = var _slicer = SELECTEDVALUE('Table'[Units])
return
IF(_slicer ="Text", BLANK() , IF( _slicer ="date" , COUNTROWS('Table') , SUMX('Table' , VALUE('Table'[Actual]))))

 

Then we can put the measure on the visual and the result is as follows:

vyueyunzhmsft_2-1682565930682.png

 

vyueyunzhmsft_3-1682565945195.png

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.